Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can gpio in lgGpioReport_t be changed to uint16_t? #30

Open
vickash opened this issue Jul 30, 2024 · 4 comments
Open

Can gpio in lgGpioReport_t be changed to uint16_t? #30

vickash opened this issue Jul 30, 2024 · 4 comments

Comments

@vickash
Copy link

vickash commented Jul 30, 2024

I'm using an Orange Pi Zero 2W. For whatever reason, the GPIO numbers on this exceed 255, so when using lgGpioSetSamplesFunc, I get reports where the GPIO numbers overflow. Reports from GPIO 258 appear to be coming from GPIO 2 for example.

@joan2937
Copy link
Owner

I will have to find some time to look into this. I thought that gpiochip GPIO numbers were constarined to be 0-63.

lg is a very low priority for me - don't expect a response soon.

@vickash
Copy link
Author

vickash commented Aug 12, 2024

I understand. I forked, changed it to uint16, and it works fine so far. I'll use that in the meantime. Opened a PR for the change as well.

@warthog618
Copy link

GPIO numbers (i.e. offsets) are NOT constrained to 0-63. You are probably thinking of the number of lines in a request which is limited to 64, cos who would want to request more than 64 lines at once, but individual GPIO chips can and do exceed that so offsets can be larger.
The GPIO uAPI defines offsets as a __u32, so you should go with that.

@vickash
Copy link
Author

vickash commented Aug 16, 2024

Updated my PR to 32 bits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants