10

Most of the libraries, in multiple languages, interact with the GPIO pins via /sys/class/gpio/export, /sys/class/gpio/import, /sys/class/gpio/gpio10/value, etc. However the linux kernel docs clearly state that is the legacy way of doing things.

What is the non legacy way of doing things?

If I understand correctly in kernel space I would use these functions or standard kernel drivers for common GPIO tasks.

What would I use for user space? Is there a Sysfs interface for the non legacy?

PS: I aware the kernel docs state that the legacy integer-based interface although considered deprecated is still usable for compatibility reasons. However I'm not interested in using that legacy code.

  • 1
    Most libraries DO NOT interact with the GPIO pins via /sys/class/gpio/export they access the hardware directly, although they CAN use kernel services. Certainly WiringPi and AFAIK pigpiod directly access SoC registers. – Milliways Aug 19 at 0:58
12

sysfs has been deprecated and has been replaced with libgpiod.

https://www.beyondlogic.org/an-introduction-to-chardev-gpio-and-libgpiod-on-the-raspberry-pi/

The interactions are with /dev/gpiochipx rather than /sys/class/gpio.

The only obvious improvement (to me) is that GPIO events now have a time-stamp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.