Udev rule for gpios for non root access
#1
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
  Reply
#2
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'"
  Reply
#3
(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
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  High-speed GPIOs dsnyder 3 4,872 05-05-2016, 09:07 PM
Last Post: martinayotte
  Python GPIOs martinayotte 3 6,765 04-15-2016, 11:12 PM
Last Post: peterz

Forum Jump:


Users browsing this thread: 1 Guest(s)