Skip to content

Udev Rules for Linux Boards

Mihai Tudor Panu edited this page Apr 23, 2018 · 1 revision

Lets try and get the rules built up so non-root can access the IO on Edison

From @deadprogram & @tingleby

SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys/class/gpio/export /sys/class/gpio/unexport; chmod 771 /sys/class/gpio/export /sys/class/gpio/unexport'"
SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio -Rh /sys/class/gpio /sys/devices/pci0000:00/0000:00:0c.0/gpio /sys/devices/pci0000:00/0000:00:08.0/i2c-1 /sys/kernel/debug/gpio_debug; chmod -R 770 /sys/class/gpio /sys/devices/pci0000:00/0000:00:0c.0/gpio /sys/devices/pci0000:00/0000:00:08.0/i2c-1 /sys/kernel/debug/gpio_debug; chmod a+rx /sys/kernel/debug'"

This does not work for me :

  • added the gpio group
  • added file /etc/udev/rules.d/80-com-gpio.rules with this content
  • when adding a led :
>>> led = mraa.Gpio(13)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/mraa.py", line 1015, in __init__
    this = _mraa.new_Gpio(pin, owner, raw)
ValueError: Invalid GPIO pin specified

Does anybody have a solution that really WORKS ? Thanks

Emutex provides Udev rules for the Up & Up^2 boards to enable GPIO, PWM, I2C, SPI and UART from user space. The details can be found here. These can be used as a reference for other Linux boards as well.

Clone this wiki locally