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

gpioioctl: Improve Registration #64

Merged
merged 3 commits into from
Nov 24, 2024
Merged

Conversation

gsexton
Copy link
Contributor

@gsexton gsexton commented Nov 22, 2024

Fixes #62

GPIO Chips with labels pinctrl-* are sorted to register first. This is a kernel convention identifying a GPIO chip that has exported/user lines.

Handling for potential duplicate chips was added. The kernel is exporting gpiochip0, and symlinking it to gpiochip4 as well. This PR ensures a chip with the same name is not registered more than once.

Cleaned up some code duplication in the basic test.

If the registration code detects that a line is already registered, it attempts to make the line name unique by prefixing it with the chip name.

Tested on a Pi5, and a Pi Zero W.

GPIO Chips, particularly on the Pi 5. Improved handling of duplicate
pin names. Code now prefixes the pin name with the chip name if it's
duplicated.
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 56 lines in your changes missing coverage. Please review.

Project coverage is 27.3%. Comparing base (75941b8) to head (9d985ec).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
gpioioctl/gpio.go 0.0% 56 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main     #64     +/-   ##
=======================================
- Coverage   27.4%   27.3%   -0.1%     
=======================================
  Files         96      96             
  Lines      11774   11815     +41     
=======================================
- Hits        3221    3220      -1     
- Misses      8418    8460     +42     
  Partials     135     135             

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


🚨 Try these New Features:

@gsexton
Copy link
Contributor Author

gsexton commented Nov 22, 2024

@maruel Not sure why this is failing. It doesn't look like something I did...

Copy link
Member

@maruel maruel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot. Everything is stylistic and optional except line 626 where it could be a real crash.

gpioioctl/gpio.go Outdated Show resolved Hide resolved
gpioioctl/gpio.go Outdated Show resolved Hide resolved
gpioioctl/gpio.go Outdated Show resolved Hide resolved
gpioioctl/gpio.go Outdated Show resolved Hide resolved
gpioioctl/gpio.go Outdated Show resolved Hide resolved
gpioioctl/gpio.go Outdated Show resolved Hide resolved
gpioioctl/gpio.go Outdated Show resolved Hide resolved
Copy link
Member

@maruel maruel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again!

@maruel maruel merged commit 63e6b8c into periph:main Nov 24, 2024
8 of 10 checks passed
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.

Edge detection does not work on Raspbian Bookworm
2 participants