direwolf
direwolf copied to clipboard
Add libgpiod support
libgpiod - C library and tools for interacting with the Linux GPIO character device (gpiod stands for GPIO device).
Since Linux 4.8 the GPIO sysfs interface is deprecated. User space should use the character device instead.
Thanks for all your great ideas. I tried this on a Raspberry Pi with all the latest updates on Buster. The gpiod and libgpiod-dev packages were installed. The direwolf PTT with gpiod seemed to go well but the GPIO pin did not change.
ptt gpiod gpiochip0 -24
Suggestion: Accept either gpiochip0 or /dev/gpiochip0. It took me a while to figure out why the latter form was failing.
"gpioinfo" mostly works but it does not have the pin names making me think it has not yet been fully customized for the RPi.
"gpioset" did not change the pin state.
gpioset gpiochip0 24=0 gpioset gpiochip0 24=1
I will get back to this after gpioset is working properly.
I tried this on a Raspberry Pi with all the latest updates on Buster.
Suddenly they rolled out a new version 13 days ago, but it shouldn't affect the test you did. Now Raspberry OS has 5.4.79 kernel still based on Debian Buster.
Suggestion: Accept either gpiochip0 or /dev/gpiochip0. It took me a while to figure out why the latter form was failing.
Good idea. I'll add the additional check.
"gpioinfo" mostly works but it does not have the pin names making me think it has not yet been fully customized for the RPi.
It depends on Linux kernel version. The latest one has all bindings: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/bcm2837-rpi-3-b.dts#n51
"gpioset" did not change the pin state. gpioset gpiochip0 24=1
It works for me but only for 40 usec. Use gpioset -m wait gpiochip0 24=1
for testing.
The direwolf PTT with gpiod seemed to go well but the GPIO pin did not change. ptt gpiod gpiochip0 -24
Let me double check that. I didn't test inverted configuration.
Anyway, thanks for trying.
This is the first thing going into development version 1.8.
PTT with gpiod/libgpiod is now available in the "dev" branch. I did a little bit of testing on an RPi 3 and it works for a simple case. It needs more testing under a variety of situations. Here is how to use it.
(1) Install packages gpiod and libgpiod-dev. (2) cd to direwolf source dir. "git pull" to get latest source. (3) Rebuild direwolf, starting with the cmake step so the new packages are noticed. (4) When direwolf starts, notice that libgpiod is listed in optional features. (5) run "gpioinfo" command to get list of gpio chip names and corresponding I/O lines. For an RPi 3, the name is "gpiochip0." I have not tried on other models yet. (6) In your config file, change PTT line from "PTT GPIO n" to "PTT GPIOD gpiochip0 n" where n is the I/O line number.