Bugs in example code, problems with force mode and missing ioctl #84
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
How did you make this work?
Like this, ioctl is never started and device address is nowhere used. Besides that, setting dev_addr was done after ioctl call,
Consequently, it failed.
With the proposed changed it runs on my Raspberry Pi Zero.
Nevertheless the proposed force mode code only returns static values.
Could be fixed by using the normal mode with code as proposed in the project's documentation.
Error handling for user read would be fine, but ok, it's up to each user.
Still I have some doubts when I compare this to I2C read&write methods of WiringPi, which calls ioctl before each access.
Did not follow up here, but guess it's needed when you want to access different devices within a program.