Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

sysfs: retain support even on older kernels#71

Open
kaespi wants to merge 1 commit intoperiph:main from
kaespi:no-ioctl-for-sysfs
Open

sysfs: retain support even on older kernels #71
kaespi wants to merge 1 commit intoperiph:main from
kaespi:no-ioctl-for-sysfs

Conversation

@kaespi
Copy link

@kaespi kaespi commented Sep 6, 2025
edited
Loading

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 host package 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).

Copy link

codecov bot commented Sep 6, 2025
edited
Loading

Codecov Report

❌ Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 27.6%. Comparing base (9cd28b7) to head (3d495b0).

Files with missing lines Patch % Lines
gpioioctl/gpio.go 0.0% 4 Missing ⚠️
sysfs/gpio.go 50.0% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


func (d *driverGPIO) Prerequisites() []string {
return []string{"ioctl-gpio"}
return nil
Copy link
Author

Choose a reason for hiding this comment

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

If there's really some dependency on ioctl-gpio we could move it to the After() below...!?

Copy link
Member

Choose a reason for hiding this comment

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

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.
Copy link

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@maruel maruel maruel left review comments

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /