Skip to content

Instantly share code, notes, and snippets.

@AlexisTM
Last active May 29, 2018 14:15
Show Gist options
  • Save AlexisTM/00c59897335f4c5a15083aff1e7d1991 to your computer and use it in GitHub Desktop.
Save AlexisTM/00c59897335f4c5a15083aff1e7d1991 to your computer and use it in GitHub Desktop.
Rootless GPIO/I2C access for odroid XU4 C1 and C2
# See https://wiki.odroid.com/troubleshooting/gpiomem
sudo apt-get install i2c-tools python-smbus
sudo addgroup gpio
sudo usermod -a -G gpio odroid
# meson-gpiomem is for C1/C2
# exynos-gpiomem is for XU4
echo """SUBSYSTEM==\"exynos-gpiomem\", GROUP=\"gpio\", MODE=\"0660\"
SUBSYSTEM==\"meson-gpiomem\", GROUP=\"gpio\", MODE=\"0660\"
SUBSYSTEM==\"i2c-dev\", ATTR{name}==\"s3c2410-i2c\" , GROUP=\"gpio\", MODE=\"0660\"
""" | sudo tee /etc/udev/rules.d/90-gpiomem.rules
echo """SUBSYSTEM==\"gpio\", KERNEL==\"gpiochip*\", ACTION==\"add\", PROGRAM=\"/bin/sh -c 'chown root:gpio /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 root:gpio /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'\"
""" | sudo tee /etc/udev/rules.d/90-odroid-sysfs.rules
# reload UDEV rules
sudo udevadm control --reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment