Search code examples
linuxraspbianraspberry-pi2gpiowiringpi

wiringPi non-root access to GPIO


From this I though acess to GPIO for non-root users would be possible using wiringPiSetupSys() but I failed trying that.

Actually, if I do setuid on the executable then it works. So, wiringPiSetupSys() isn't enought?

$ ./gpio write 4 1  // This don't work :(
# chown root gpioapp
# chmod u+x gpioapp
$ ./gpio write 4 1  // This works :)

Solution

  • Is your non-root user a member of the gpio group? – Ben Voigt

    Yeah, that's the point! It wasn't, just changed (usermod -a -G gpio myuser) and now it's working. – KcFnMi