Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6746

C/C++ • Re: Example of GPIO use with Linux only (no third party libraries)

$
0
0
Very nice! I use ioctl() for I2C and SPI and direct sysfs export, read, write for hardware PWM, but had not played with the /dev/gpiochipX interface yet, preferring the /dev/gpiomem approach for non-root access for members of the gpio group. Why there is a need to deprecate that specialized device that provides user access to the GPIO memory is unwelcome as that was the whole purpose for the gpiomem carve-out from /dev/mem.

I look similarly on the gpiod and other "new" root-only GPIO interfaces. They are clunky overly complex and awkward to work with - and you are stuck running as root. May as well just use the bcm2835 library at that point - it's faster and lighter. But I cannot stand providing code that must be run as root. Sure on a limited system running busybox, etc.. where the only interface is /dev/mem, that is inevitable. But this is the Pi running full Linux and there is no sane reason for requiring superuser rights to work with the device subsytems. (soap-box - off)

I'll go through your post and the kernel docs and make friends with the approach. Thank you again!

Statistics: Posted by drankinatty — Fri Apr 19, 2024 6:56 am



Viewing all articles
Browse latest Browse all 6746

Trending Articles