rene0 / dcf77pi

Yet another DCF77 decoder. This one is intended for the Raspberry Pi platform but might work on other devices using GPIO pins too.
BSD 2-Clause "Simplified" License
18 stars 6 forks source link

Replace legacy sysfs code with chardev #39

Open rene0 opened 4 years ago

rene0 commented 4 years ago

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

rene0 commented 4 years ago

@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 commented 4 years ago

This is on a Rasperry Pi 1B.

Avamander commented 4 years ago

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

rene0 commented 4 years ago

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.

Avamander commented 4 years ago

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.

rene0 commented 4 years ago

That is just with gpiomon GPIODEVICE PIN ?

Avamander commented 4 years ago

Yes

rene0 commented 4 years ago

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

rene0 commented 3 years ago

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 commented 3 years ago

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.