Drive a GPIO line high with gpioset -c chip line=1
Set a GPIO output with gpioset from libgpiod 2.x, selecting the chip with -c, and keep the process alive because the line reverts when it exits.
Shell scripts that toggled /sys/class/gpio stopped working once the sysfs interface was deprecated. The replacement is the character device, and gpioset from libgpiod 2.x drives it.
gpioset -c gpiochip0 17=1In libgpiod 2 the chip comes from -c and each line is offset=value. The behaviour that surprises people from v1 is that the line is held only while gpioset runs, because the kernel releases a requested line when its file descriptor closes, and the pin returns to its default. In v2 the command stays in the foreground until you press Ctrl-C, which is exactly why the LED stays lit. To leave it running in the background use --daemonize, and to pulse it use --toggle:
gpioset -c gpiochip0 --daemonize 17=1
gpioset -c gpiochip0 --toggle 500ms,500ms,0 17=1$ gpioinfo -c gpiochip0 17
line 17: "GPIO17" "gpioset" output active-high [used]The second command blinks the line once at 500 ms intervals and then leaves it inactive; the final 0 ends the sequence. The gpioinfo layout shown is representative, and the consumer name gpioset appears only while the line is held. Line names and the number of lines depend on the board's device tree. See the libgpiod tools documentation. The v1 syntax, gpioset gpiochip0 17=1, is rejected by v2.