From f627f20a298d441b5d94ba4ab80a1121065f1f75 Mon Sep 17 00:00:00 2001 From: Oleksandr Suvorov Date: Thu, 6 Aug 2020 16:05:22 +0300 Subject: colibri-imx7: udev: add symlink to adc raw data Create symlinks for each supported by Colibri iMX7/iMX7-eMMC ADC channels, standardizing names as colibri-ainX, according to the Colibri signal names table. Related-to: ELB-2839 Signed-off-by: Oleksandr Suvorov --- recipes-core/udev/files/colibri-imx7/toradex-adc.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 recipes-core/udev/files/colibri-imx7/toradex-adc.sh (limited to 'recipes-core/udev/files/colibri-imx7/toradex-adc.sh') diff --git a/recipes-core/udev/files/colibri-imx7/toradex-adc.sh b/recipes-core/udev/files/colibri-imx7/toradex-adc.sh new file mode 100755 index 0000000..163b1ee --- /dev/null +++ b/recipes-core/udev/files/colibri-imx7/toradex-adc.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env sh +# +# Called from udev. Compatible to colibri-imx7. +# +# Create/remove symlinks to/from the files with raw ain data. + +# Map the ADC lines: +# colibri-ain{0..3} -> ADC1_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/colibri-ain$idx + done +elif [ "$ACTION" = "remove" ]; then + for idx in `seq 0 $((LINES-1))`; do + rm -f /dev/colibri-ain$idx + done +fi + -- cgit v1.2.3