The GPIO sysfs interface has however been deprecated since version 4.8 of the kernel and the snapd GPIO interface should provide access to /sys/bus/gpiochipN (or /dev/gpiochipN) instead
"Warning
THIS ABI IS DEPRECATED, THE ABI DOCUMENTATION HAS BEEN MOVED TO Documentation/ABI/obsolete/sysfs-gpio AND NEW USERSPACE CONSUMERS ARE SUPPOSED TO USE THE CHARACTER DEVICE ABI. THIS OLD SYSFS ABI WILL NOT BE DEVELOPED (NO NEW FEATURES), IT WILL JUST BE MAINTAINED."
The descriptor-based interface is the preferred way to manipulate GPIOs, and is described by all the files in this directory excepted gpio-legacy.txt.
The legacy integer-based interface which is considered deprecated (but still usable for compatibility reasons) is documented in gpio-legacy.txt.
sysfs GPIO
User-mode GPIO (General Purpose Input/Output) has historically been performed via the legacy “integer-based”sysfs pseudo file system. For example, to set GPIO25, one would:
# echo out > /sys/class/gpio/gpio25/direction
# echo 1 > /sys/class/gpio/gpio25/value
GPIO access via this legacy sysfs interface has been deprecated since version 4.8 of the Linux kernel.
chardev GPIO
The new way of doing GPIO is via the “descriptor-based” character device ABI (Application Binary Interface). The interface is exposed at /dev/gpiochipN or /sys/bus/gpiochipN where N is the chip number.
The snapd builtin gpio interface provides access to the GPIO sysfs Interface for userspace at sys/class/gpio/gpio
https:/ /github. com/snapcore/ snapd/blob/ 45d65822c95b7f7 f4120ec4a9723f2 af0bb5b4b8/ interfaces/ builtin/ gpio.go# L44
The GPIO sysfs interface has however been deprecated since version 4.8 of the kernel and the snapd GPIO interface should provide access to /sys/bus/gpiochipN (or /dev/gpiochipN) instead
Reference:
1) https:/ /www.kernel. org/doc/ html/latest/ admin-guide/ gpio/sysfs. html
"Warning ABI/obsolete/ sysfs-gpio AND NEW USERSPACE CONSUMERS ARE SUPPOSED TO USE THE CHARACTER DEVICE ABI. THIS OLD SYSFS ABI WILL NOT BE DEVELOPED (NO NEW FEATURES), IT WILL JUST BE MAINTAINED."
THIS ABI IS DEPRECATED, THE ABI DOCUMENTATION HAS BEEN MOVED TO Documentation/
2)https:/ /www.kernel. org/doc/ Documentation/ ABI/obsolete/ sysfs-gpio
"This ABI is deprecated and will be removed after 2020. It is
replaced with the GPIO character device."
3) https:/ /www.kernel. org/doc/ html/latest/ driver- api/gpio/ intro.html
The descriptor-based interface is the preferred way to manipulate GPIOs, and is described by all the files in this directory excepted gpio-legacy.txt.
The legacy integer-based interface which is considered deprecated (but still usable for compatibility reasons) is documented in gpio-legacy.txt.
4) https:/ /www.beyondlogi c.org/an- introduction- to-chardev- gpio-and- libgpiod- on-the- raspberry- pi/
sysfs GPIO based”sysfs pseudo file system. For example, to set GPIO25, one would:
User-mode GPIO (General Purpose Input/Output) has historically been performed via the legacy “integer-
# echo out > /sys/class/ gpio/gpio25/ direction gpio/gpio25/ value
# echo 1 > /sys/class/
GPIO access via this legacy sysfs interface has been deprecated since version 4.8 of the Linux kernel.
chardev GPIO
The new way of doing GPIO is via the “descriptor-based” character device ABI (Application Binary Interface). The interface is exposed at /dev/gpiochipN or /sys/bus/gpiochipN where N is the chip number.