PINE64
Udev rule for gpios for non root access - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PINE A64(+) (https://forum.pine64.org/forumdisplay.php?fid=4)
+--- Forum: Pine A64 Hardware, Accessories and POT (https://forum.pine64.org/forumdisplay.php?fid=32)
+---- Forum: Pi2, Euler and Exp GPIO Ports (https://forum.pine64.org/forumdisplay.php?fid=34)
+---- Thread: Udev rule for gpios for non root access (/showthread.php?tid=7585)



Udev rule for gpios for non root access - dkebler - 06-11-2019

Using armbian bionic mainline kernel on A64-v1.1 board
Linux pine64 4.19.38-sunxi64 #5.83 SMP Fri May 3 21:02:31 CEST 2019 aarch64 aarch64 aarch64 GNU/Linux

Need to allow non-root access to gpio pins (i.e. gpio group with access to export and unexport etc) via udev.  I've done this successfully before on an RPI but no matter what I try the gpio group and permissions are not set.   Maybe it's something specific to Pine64 so asking here.  

here is one version of rules I've tried.   using udevadm I've confirmed the file is read and loaded but the changes are not made

Code:
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'find -L /sys/class/gpio/ -maxdepth 2 -exec chown root:gpio {} \; -exec chmod 770 {} \; || true'"


Any suggestions?  Anyone have a successful udev rules for this board?  If so please share


RE: Udev rule for gpios for non root access - dkebler - 06-11-2019

looks like it was working but needed to first manually chown gpio group to export and unexport values.

FYI the rule doesn't change the owner/permission for the directories of /sys/call/gpio  but their subdirectories yes.  

Further because of the soft links therein for device and subsystem find will report loop detected but the || true apparently suppresses that error and will continue

Also must include the action add so it will be done for each new in export.

Code:
SUBSYSTEM=="gpio*", ACTION=="add", PROGRAM="/bin/sh -c 'find -L /sys/class/gpio/ -maxdepth 2 -exec chown root:gpio {} \; -exec chmod 770 {} \; || true'"



RE: Udev rule for gpios for non root access - tllim - 06-13-2019

(06-11-2019, 09:06 AM)dkebler Wrote: Using armbian bionic mainline kernel on A64-v1.1 board
Linux pine64 4.19.38-sunxi64 #5.83 SMP Fri May 3 21:02:31 CEST 2019 aarch64 aarch64 aarch64 GNU/Linux

Need to allow non-root access to gpio pins (i.e. gpio group with access to export and unexport etc) via udev.  I've done this successfully before on an RPI but no matter what I try the gpio group and permissions are not set.   Maybe it's something specific to Pine64 so asking here.  

here is one version of rules I've tried.   using udevadm I've confirmed the file is read and loaded but the changes are not made

Code:
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'find -L /sys/class/gpio/ -maxdepth 2 -exec chown root:gpio {} \; -exec chmod 770 {} \; || true'"


Any suggestions?  Anyone have a successful udev rules for this board?  If so please share

Hopefully this article helps: http://synfare.com/599N105E/hwdocs/pine64/index.html