Hi, On Wed, May 24, 2017 at 07:58:19AM -0400, Robert P. J. Day wrote:
ashamed to admit, i haven't been keeping up with this, so AIUI, the GPIO sysfs interface is deprecated, replaced with character device files (/dev/gpiochip*) to allow access to GPIO.
first, i find it curious that this is a move away from sysfs access to using ioctl(), since i had always thought ioctls were massively discouraged in new code. is there a document that goes through the rationale for this change?
and i notice under Documentation/ABI/ that sysfs-gpio is listed under "obsolete", while gpio-cdev is listed under "testing". this seems inconsistent -- how can one be obsolete while the other be categorized as testing? that just seems strange.
in any event, is the /dev/gpiochip* interface the recommended interface now? thanks.
Linus Walleij described the rationale in the first commit description. Have a look at 3c702e9987e2. Implementing it with netlink sockets would have made it much more complex, I suppose this is why they chose ioctl? By the way, I can recommend accessing the GPIO chardev with libgpiod: https://github.com/brgl/libgpiod This simplifies using it a lot! The tools are also quite nice. Cheers, Clemens