diff options
author | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2020-08-06 16:35:29 +0300 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2020-09-14 09:46:54 +0200 |
commit | 42a07ea73dae20516701401765ca7cf743500a4b (patch) | |
tree | bd580fa0df5a00fea51d462537430fb0952a939b /recipes-core/udev/files/apalis-imx8/toradex-adc.sh | |
parent | e9950a3a638a8b13cfd566ba78cbdeec4da586bb (diff) |
apalis-imx8: udev: add symlink to adc raw data
Create symlinks for each supported by Apalis iMX8 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 a98861ebc9d2a26f458a57f674b53cb81405da64)
Diffstat (limited to 'recipes-core/udev/files/apalis-imx8/toradex-adc.sh')
-rwxr-xr-x | recipes-core/udev/files/apalis-imx8/toradex-adc.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/recipes-core/udev/files/apalis-imx8/toradex-adc.sh b/recipes-core/udev/files/apalis-imx8/toradex-adc.sh new file mode 100755 index 0000000..fdc5365 --- /dev/null +++ b/recipes-core/udev/files/apalis-imx8/toradex-adc.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env sh +# +# Called from udev. Compatible to apalis-imx8. +# +# Create/remove symlinks to/from the files with raw ain data. + +# Map the ADC lines: +# apalis-adc{0..3} -> DMA.ADC.IN{0,1,2,3} +LINES=4 +START=0 + +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 + |