sysfs: retain support even on older kernels#71
Open
kaespi wants to merge 1 commit intoperiph:mainfrom
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #71 +/- ##
=======================================
+ Coverage 27.2% 27.6% +0.4%
=======================================
Files 96 96
Lines 11834 9481 -2353
=======================================
- Hits 3220 2613 -607
+ Misses 8479 6733 -1746
Partials 135 135 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kaespi
commented
Sep 9, 2025
|
|
||
| func (d *driverGPIO) Prerequisites() []string { | ||
| return []string{"ioctl-gpio"} | ||
| return nil |
Author
There was a problem hiding this comment.
If there's really some dependency on ioctl-gpio we could move it to the After() below...!?
Member
There was a problem hiding this comment.
good question. I think moving into After is the right call.
kaespi
referenced
this pull request
Sep 9, 2025
Includes new unit test that are conditionally compiled on linux. Mock in case of no chip available.
|
feedback on this issue would be appreciated. |
The ioctl-gpio driver was declared a prerequisite of the sysfs-gpio driver. But since on older Linux kernels (earlier than 5.10) the GPIO v2 interface is not yet available. Therefore, the ioctl-gpio driver is not available for such systems. To still support the sysfs access for those make the ioctl-gpio driver independent of the sysfs-gpio driver. Note: the ioctl-gpio driver is still attempted to load.
23180a3 to
3d495b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The ioctl-gpio driver was declared a prerequisite of the sysfs-gpio driver. But since on older Linux kernels (earlier than 5.10) the GPIO v2 interface is not yet available. Therefore, the ioctl-gpio driver is not available for such systems. To still support the sysfs access for those make the ioctl-gpio driver independent of the sysfs-gpio driver.
Note: the ioctl-gpio driver is still attempted to load.
This renders #39 (implemented in #59) a bit more backwards compatabile.
Background: we're using periph.io on our embedded Linux with kernel 5.4.193. It was all working fine until we recently upgraded the
hostpackage from 3.8.2 to 3.8.5. Suddenly nothing was working anymore. We noticed the error is in the initialization of the ioctl-gpio driver which uses the GPIO v2 interface, which is not yet available on our kernel. Since we only use the sysfs-gpio driver we removed the dependency on ioctl-gpio and all was working fine again. Therefore, I guess more people would want to have backwards compatibility (in particular since the change was introduced in 3.8.2 -> 3.8.3 which is supposed to be non-breaking, I guess).