For some time I've heard about the new GPIO character device API, sysfs deprecated, etc. Since I recently upgraded one of my RPi to bullseye, I decided to try this new API - or at least the "user tools" in the package named gpiod. I wanted a GPIO interface I could use in shell scripts, and from the cli.
I connected an LED and a 330 resistor in series between GPIO 25 and GND.
The material I read before deciding to try libgpiod/gpiod made use of the gpiod tools look very straightforward: 1, 2, 3, 4. So far, my experience has been anything but straightforward - at least with the gpioset tool.
Here's the issue:
$ gpioset pinctrl-bcm2835 25=1 # LED not illuminated
$ gpioset gpiochip0 25=1 # LED not illuminated
$ gpioset 0 25=1 # LED not illuminated
# gpioget issued immediately after gpioset returned 0 ?!
After "poking around", it seems gpioset ... is not persistent. man gpioset & gpioset -h describe 4 Modes:: I was able to illuminate the LED using the time & wait modes, but these modes are not generally well-suited for many situations. The exit mode seems to be the default, but it apparently toggles the GPIO so quickly that there is no trace of light - useless for an LED iow. And finally the signal mode described as follows: set values and wait for SIGINT or SIGTERM. Hmmm - interesting technique for switching GPIO output state.
I've found a few unofficial sources online that seem to confirm what I'm seeing; i.e. that gpioset is bizarrely non-persistent. But there don't seem to be any solutions offered - other than this ha project code.
Can anyone here confirm this, or offer a solution to get persistent GPIO control using gpioset or another tool based on libgpiod?