diff options
Diffstat (limited to 'recipes-core/udev')
-rw-r--r-- | recipes-core/udev/files/colibri-imx6/99-toradex.rules | 1 | ||||
-rwxr-xr-x | recipes-core/udev/files/colibri-imx6/toradex-adc.sh | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/recipes-core/udev/files/colibri-imx6/99-toradex.rules b/recipes-core/udev/files/colibri-imx6/99-toradex.rules index d27f029..59cf815 100644 --- a/recipes-core/udev/files/colibri-imx6/99-toradex.rules +++ b/recipes-core/udev/files/colibri-imx6/99-toradex.rules @@ -10,3 +10,4 @@ ACTION=="add", SUBSYSTEM=="spidev", KERNELS=="2014000.*spi", SYMLINK+="colibri-s KERNEL=="mmcblk[0-9]", ENV{DEVTYPE}=="disk", KERNELS=="2198000.usdhc", SYMLINK+="emmc" KERNEL=="mmcblk[0-9]boot[0-9]", ENV{DEVTYPE}=="disk", KERNELS=="2198000.usdhc", SYMLINK+="emmc-boot%n" KERNEL=="mmcblk[0-9]p[0-9]", ENV{DEVTYPE}=="partition", KERNELS=="2198000.usdhc", SYMLINK+="emmc-part%n" +SUBSYSTEM=="iio", KERNELS=="iio:device0", RUN+="/etc/udev/scripts/toradex-adc.sh" diff --git a/recipes-core/udev/files/colibri-imx6/toradex-adc.sh b/recipes-core/udev/files/colibri-imx6/toradex-adc.sh new file mode 100755 index 0000000..692fafc --- /dev/null +++ b/recipes-core/udev/files/colibri-imx6/toradex-adc.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env sh +# +# Called from udev. Compatible to colibri-imx6. +# +# Create/remove symlinks to/from the files with raw ain data. + +# Map the ADC lines: +# colibri-ain{0..3} -> STMPE811 ADC{4,5,6,7} in terms of the driver. +LINES=4 +START=4 + +if [ "$ACTION" = "add" ]; then + for idx in `seq 0 $((LINES-1))`; do + ln -s "/sys$DEVPATH/in_voltage$((START+idx))_raw" /dev/colibri-ain$idx + done +elif [ "$ACTION" = "remove" ]; then + for idx in `seq 0 $((LINES-1))`; do + rm -f /dev/colibri-ain$idx + done +fi + |