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

bcm283x: Issue 62 Change bcm283x to use ioctl for GPIO pins, not sysfs. #63

Merged
merged 9 commits into from
Oct 21, 2024

Conversation

gsexton
Copy link
Contributor

@gsexton gsexton commented Oct 21, 2024

This fixes Edge detection does not work on Raspbian Bookworm #62

It changes the bcm283x/gpio.go to use gpioioctl rather than sysfs.

With this patch, obtaining GPIO pins via:

      outPin:=gpioreg.ByName("GPIO2")
      inPin:=gpioreg.ByName("GPIO10")

or
        outPin:=rpi.P1_3
        inPin:=rpi.P1_19

now work as expected.

@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 34.72222% with 94 lines in your changes missing coverage. Please review.

Project coverage is 27.4%. Comparing base (7540d26) to head (5005af9).

Files with missing lines Patch % Lines
gpioioctl/gpio.go 18.6% 48 Missing ⚠️
bcm283x/gpio.go 34.4% 20 Missing and 1 partial ⚠️
gpioioctl/ioctl.go 0.0% 6 Missing ⚠️
gpioioctl/syscall.go 0.0% 6 Missing ⚠️
gpioioctl/syscall_other.go 0.0% 6 Missing ⚠️
gpioioctl/dummy.go 82.8% 4 Missing and 1 partial ⚠️
gpioioctl/lineset.go 0.0% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main     #63     +/-   ##
=======================================
+ Coverage   26.8%   27.4%   +0.5%     
=======================================
  Files         92      96      +4     
  Lines      11548   11774    +226     
=======================================
+ Hits        3097    3221    +124     
- Misses      8316    8418    +102     
  Partials     135     135             

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gsexton
Copy link
Contributor Author

gsexton commented Oct 21, 2024

@maruel can you give me an idea of how to fix this?

periph.io/x/host/v3/bcm283x

Error: bcm283x/gpio.go:199:22: undefined: gpioioctl.GPIOLine
Error: bcm283x/gpio.go:1334:19: undefined: gpioioctl.Chips
Error: bcm283x/gpio.go:1378:21: undefined: gpioioctl.Chips

@gsexton
Copy link
Contributor Author

gsexton commented Oct 21, 2024

@maruel can you give me an idea of how to fix this?

periph.io/x/host/v3/bcm283x

Error: bcm283x/gpio.go:199:22: undefined: gpioioctl.GPIOLine Error: bcm283x/gpio.go:1334:19: undefined: gpioioctl.Chips Error: bcm283x/gpio.go:1378:21: undefined: gpioioctl.Chips

NM, I see the problem. gpioioctl doesn't exist for Windows/MacOS, and that's messing with it.

@maruel
Copy link
Member

maruel commented Oct 21, 2024

The stance periph.io takes is that the code is compilable on all platforms so users can read the documentation, e.g. in VSCode while on Windows but functionality that do not make sense (e.g. bcm238x on Windows) is okay to not work.

@maruel maruel merged commit 75941b8 into periph:main Oct 21, 2024
8 checks passed
@maruel
Copy link
Member

maruel commented Oct 21, 2024

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants