commit 3db5cfd6ed9c7fe4fe4fb7a2e4e9a80331141ecf
parent ea0069065d16b91cdc57766b21333d0ee630f967
Author: parazyd <parazyd@dyne.org>
Date: Fri, 4 May 2018 14:20:39 +0200
Add 99-com.rules for Pi2.
This closes #87.
Diffstat:
1 file changed, 33 insertions(+), 0 deletions(-)
diff --git a/extra/raspi2/etc/udev/rules.d/99-com.rules b/extra/raspi2/etc/udev/rules.d/99-com.rules
@@ -0,0 +1,33 @@
+SUBSYSTEM=="input", GROUP="input", MODE="0660"
+SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0660"
+SUBSYSTEM=="spidev", GROUP="spi", MODE="0660"
+SUBSYSTEM=="bcm2835-gpiomem", GROUP="gpio", MODE="0660"
+
+SUBSYSTEM=="gpio", GROUP="gpio", MODE="0660"
+SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c '\
+ chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\
+ chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio;\
+ chown -R root:gpio /sys$devpath && chmod -R 770 /sys$devpath\
+'"
+
+KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\
+ ALIASES=/proc/device-tree/aliases; \
+ if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
+ echo 0;\
+ elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
+ echo 1; \
+ else \
+ exit 1; \
+ fi\
+'", SYMLINK+="serial%c"
+
+KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
+ ALIASES=/proc/device-tree/aliases; \
+ if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
+ echo 0; \
+ elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
+ echo 1; \
+ else \
+ exit 1; \
+ fi \
+'", SYMLINK+="serial%c"