volumio / Build

Buildscripts for Volumio System
GNU General Public License v2.0
113 stars 102 forks source link

Raspberry Pi GPIO Permissions #424

Closed dbrgn closed 3 years ago

dbrgn commented 3 years ago

(I hope this is the proper repository for reporting this issue.)

As volumio user, I cannot access /dev/gpiochip0, even though I'm in the gpio group.

volumio@volumio:~$ cat /etc/group | grep gpio
gpio:x:998:volumio
volumio@volumio:~$ ls -la /dev/gpiochip*
crw------- 1 root root 254, 0 Nov  2 12:02 /dev/gpiochip0
crw------- 1 root root 254, 1 Nov  2 12:02 /dev/gpiochip1
crw------- 1 root root 254, 2 Nov  2 12:02 /dev/gpiochip2

According to the library I'm using, this should work:

2020-11-02-135811_965x270_scrot

Of course I can fix this myself, but it would be nice if the image would support these permissions out of the box :slightly_smiling_face:

dbrgn commented 3 years ago

Can be fixed by changing the following in /etc/udev/rules.d/92-gpio.rules (just add GROUP="gpio"):

-SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ACTION=="add", PROGRAM="/bin/sh -c 'chown volumio:volumio /sys/class/gpio/export /sys/class/gpio/unexport ; chmod 220 /sys/class/gpio/export /sys/class/gpio/unexport'"
-SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add", PROGRAM="/bin/sh -c 'chown volumio:volumio /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value ; chmod 660 /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value'"
+SUBSYSTEM=="gpio", KERNEL=="gpiochip*", GROUP="gpio", ACTION=="add", PROGRAM="/bin/sh -c 'chown volumio:volumio /sys/class/gpio/export /sys/class/gpio/unexport ; chmod 220 /sys/class/gpio/export /sys/class/gpio/unexport'"
+SUBSYSTEM=="gpio", KERNEL=="gpio*", GROUP="gpio", ACTION=="add", PROGRAM="/bin/sh -c 'chown volumio:volumio /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value ; chmod 660 /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value'"
macmpi commented 3 years ago

Not sure current build uses latest of raspberrypi-sys-mods as that package is cached in own @volumio repo. You may check if latest rule fixes your issue.

ashthespy commented 3 years ago

I believe http://archive.volumio.org/debian/ is just a mirror of archive.raspberrypi.org -- so packages are the same. :-)

$ curl -s http://archive.raspberrypi.org/debian/dists/jessie/main/binary-armhf/Packages | grep 'Package: raspberrypi-sys-mods' -B 2
Package: raspberrypi-sys-mods
Version: 20170519

$ curl -s http://archive.volumio.org/debian/dists/jessie/main/binary-armhf/Packages | grep 'Package: raspberrypi-sys-mods' -B 2
Package: raspberrypi-sys-mods
Version: 20170519