diff options
author | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2020-08-06 11:58:51 +0300 |
---|---|---|
committer | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2020-08-10 13:11:02 +0300 |
commit | eaf8ba320beef0b0ad59e7911b4684c793b0a4f3 (patch) | |
tree | 91cda041da4192329d1ea9fe30da85bc3db1bd01 /recipes-core/udev/files/colibri-imx6/toradex-adc.sh | |
parent | 22950c7feac191bbff58e9137612e525982e2fbe (diff) |
colibri-imx6: udev: add symlink to adc raw data
Create symlinks for each supported by Colibri iMX6 ADC channels,
standardizing names as colibri-ainX, according to the Colibri signal
names table.
Related-to: ELB-2839
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Diffstat (limited to 'recipes-core/udev/files/colibri-imx6/toradex-adc.sh')
-rwxr-xr-x | recipes-core/udev/files/colibri-imx6/toradex-adc.sh | 21 |
1 files changed, 21 insertions, 0 deletions
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 + |