dcf77pi icon indicating copy to clipboard operation
dcf77pi copied to clipboard

Replace legacy sysfs code with chardev

Open rene0 opened this issue 5 years ago • 10 comments

sysfs has been deprecated since Linux 4.8, replace the existing sysfs code to interface with GPIO in the Linux version with chardev.

rene0 avatar Feb 23 '20 18:02 rene0

@Avamander I tried running some tools from libgpiod (gpiomon etc) but these do not seem to work properly. I have a DCF77 and an NPL receiver hooked up, for one it always return a high readout and for the other always a low readout. This also happens with the sysfs code. Kernel is 4.19 from Debian Buster. I am member of the gpio group.

However if I run the same code (from dcf77pi using the sysfs interface) with an ancient 3.10.25 kernel I get the expected result.

Would you have an idea of what's going on?

rene0 avatar Mar 08 '20 17:03 rene0

This is on a Rasperry Pi 1B.

rene0 avatar Mar 08 '20 18:03 rene0

It might be that on such an old kernel libgpiod doesn't work properly?

Avamander avatar Mar 08 '20 18:03 Avamander

That distribution is old enough to not have libgpiod (nor is it properly updateable anymore). Reading the GPIO pins using sysfs using the old kernel works fine, but the new kernel refuses.

rene0 avatar Mar 08 '20 18:03 rene0

4.19 might still be a tad too old, I've tried gpiomon on 5.3 and it seems to work.

I don't have a good DCF77 signal source or the code to test if it works for decoding DCF77 however.

Avamander avatar Mar 08 '20 18:03 Avamander

That is just with gpiomon GPIODEVICE PIN ?

rene0 avatar Mar 08 '20 18:03 rene0

Yes

Avamander avatar Mar 08 '20 18:03 Avamander

Hm, so something is off with Debian Buster (kernel 4.19) then :( Thanks for the insights.

rene0 avatar Mar 08 '20 18:03 rene0

The same happens for me on Raspbian Buster with kernel 5.4.72, both the sysfs and chardev interface seem stuck at the same value (either all low or all high). A reboot to clear the kernel state did not help.

rene0 avatar Nov 01 '20 11:11 rene0

Looks like none of the 54 (out of 24 for the Raspberry Pi 1B ?) work on Linux 5.4.72 using the chardev interface. It works fine on FreeBSD 12.2-RELEASE.

rene0 avatar Nov 01 '20 12:11 rene0