summaryrefslogtreecommitdiff
path: root/recipes-core/udev/files/apalis-imx6/toradex-adc.sh
diff options
context:
space:
mode:
authorOleksandr Suvorov <oleksandr.suvorov@toradex.com>2020-08-03 18:59:57 +0300
committerMax Krummenacher <max.krummenacher@toradex.com>2020-09-14 09:46:53 +0200
commite9950a3a638a8b13cfd566ba78cbdeec4da586bb (patch)
tree45ae7f3ab545ddae0c4ee475c3cb283cee7f0610 /recipes-core/udev/files/apalis-imx6/toradex-adc.sh
parent9de495e99756b66fc2a5d5599a26339fcca5cc53 (diff)
apalis-imx6: udev: add symlink to adc raw data
Create symlinks for each supported by Apalis iMX6 ADC channels, standardizing names as apalis-adcX, according to the Apalis signal names table. Related-to: ELB-2839 Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com> (cherry picked from commit 41ebdf6d19a1b8af2e06f274d711823bdb345f29)
Diffstat (limited to 'recipes-core/udev/files/apalis-imx6/toradex-adc.sh')
-rwxr-xr-xrecipes-core/udev/files/apalis-imx6/toradex-adc.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/recipes-core/udev/files/apalis-imx6/toradex-adc.sh b/recipes-core/udev/files/apalis-imx6/toradex-adc.sh
new file mode 100755
index 0000000..9776fda
--- /dev/null
+++ b/recipes-core/udev/files/apalis-imx6/toradex-adc.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env sh
+#
+# Called from udev. Compatible to apalis-imx6.
+#
+# Create/remove symlinks to/from the files with raw ain data.
+
+# Map the ADC lines:
+# apalis-adc{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/apalis-ain$idx
+ done
+elif [ "$ACTION" = "remove" ]; then
+ for idx in `seq 0 $((LINES-1))`; do
+ rm -f /dev/apalis-ain$idx
+ done
+fi
+