Skip to content

Instantly share code, notes, and snippets.

@aztecrex
Last active August 26, 2017 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aztecrex/a5b3f5fe0340085da2fdaf4efd253f11 to your computer and use it in GitHub Desktop.
Save aztecrex/a5b3f5fe0340085da2fdaf4efd253f11 to your computer and use it in GitHub Desktop.
C.H.I.P. GPIO as normal user
This allows anyone in the "gpio" group to do GPIO operations
------ /etc/udev/rules.d/98-gpio-group.rules
# UDEV RULE TO CHANGE GPIO GROUP
# INITIALLY WRITTEN BY IOT_STEVE
# UPDATED BY XTACOCOREX
# THIS REQUIRES change_gpio_perms.sh TO BE INSTALLED IN /usr/local/bin/
SUBSYSTEM=="gpio", PROGRAM="/usr/local/bin/change_gpio_perms.sh"
------- /usr/local/bin/change_gpio_perms.sh
#!/bin/sh
# CHANGE PERMISSIONS AND GROUP FOR THE XIO-P* PINS
/bin/chown -R root:gpio /sys/devices/platform/soc\@01c00000/1c2b400.i2c/i2c-2/2-0038/gpio
/bin/chmod -R ug+rw /sys/devices/platform/soc\@01c00000/1c2b400.i2c/i2c-2/2-0038/gpio
# CHANGE PERMISSIONS AND GROUP FOR THE R8 PINS
/bin/chown -R root:gpio /sys/devices/platform/soc@01c00000/1c20800.pinctrl/gpio
/bin/chmod -R ug+rw /sys/devices/platform/soc@01c00000/1c20800.pinctrl/gpio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment