Yeah, sadly nothing is chiselled in stone these days. There were problems with the sysfs interface that could not be solved using that interface, so the decision was made to switch to an ioctl based interface, so the one gpiod uses. That was in Linux 4.8, and users have been encouraged to move ever since, though many remained unaware or kept using sysfs or in the case of the Pi /dev/gpiomem as they kept on working.While I don't understand why moving forward one would break such functionality, at this point what is the recommended replacement way to toggle GPIO from a shell script that works on both new and old kernels?
gpiod may work for you for Linux 4.8 or later, but some behaviour is dependent on the GPIO driver in the kernel so older kernels might not work as you expect, most notably gpioset used to have to be kept running to keep the value as set. That has changed in more recent Pi kernels, so you can call gpioset and the value will stick, but I'm not sure exactly when that was changed.
So, depending on what you call old, gpiod might be sufficient for you, or you may need to use sysfs for old kernels and gpiod for new.
Statistics: Posted by warthog618 — Sat Apr 06, 2024 8:03 am