Skip to content

Adjust periphery implementation to not set GPIO V2 real-time flag#43

Open
theshaun wants to merge 1 commit intorightup:feat/newRadiosfrom
theshaun:feat/newRadios
Open

Adjust periphery implementation to not set GPIO V2 real-time flag#43
theshaun wants to merge 1 commit intorightup:feat/newRadiosfrom
theshaun:feat/newRadios

Conversation

@theshaun
Copy link

@theshaun theshaun commented Mar 7, 2026

After further digging at the core issue with older kernels I discovered that the root cause relates to GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME being set when edge detection is used

https://github.com/vsergeev/python-periphery/blob/master/periphery/gpio_cdev2.py#L261C13-L261C19

GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME seems to have been added into the linux kernel in 5.16 or so. A lot of Rockchip boards still use 5.10.~

Given we do not seem to need timestamps for the interrupts its not necessary to have this flag set. And given that python-periphery is not actively maintained (it seems) it is easier to make the change here for our use case, but i'll update an existing issue upstream to see if there is a way they can implement a fix.

I expect that after some longer testing, we may be able to remove the gpiod implementation I added previously as this will allow luckfox and other rockchip devices to just use python-periphery

…OCK_REALTIME in order to support older kernals without the need for gpiod
@rightup
Copy link
Owner

rightup commented Mar 7, 2026

Well this is a brilliant find!

@theshaun
Copy link
Author

Have had this running on some boards for a while with no dramas. I feel this is save to use, but happy to add a flag to enact this if that seems better

@rightup
Copy link
Owner

rightup commented Mar 14, 2026 via email

@theshaun
Copy link
Author

I don't believe it should. I did consider if we had kernel detection. but given some vendors cherry pick it might be present somewhere in a version we don't think it would be (slim though).

When multi radio is added, is it anticipated to need real time output of GPIO state?

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

Successfully merging this pull request may close these issues.

2 participants