summaryrefslogtreecommitdiff
path: root/recipes-core/udev
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-core/udev')
-rw-r--r--recipes-core/udev/files/apalis-imx6/99-toradex.rules1
-rwxr-xr-xrecipes-core/udev/files/apalis-imx6/toradex-adc.sh21
-rwxr-xr-xrecipes-core/udev/files/toradex-adc.sh4
-rw-r--r--recipes-core/udev/udev-toradex-rules.bb3
4 files changed, 29 insertions, 0 deletions
diff --git a/recipes-core/udev/files/apalis-imx6/99-toradex.rules b/recipes-core/udev/files/apalis-imx6/99-toradex.rules
index 58c3a86..f29daae 100644
--- a/recipes-core/udev/files/apalis-imx6/99-toradex.rules
+++ b/recipes-core/udev/files/apalis-imx6/99-toradex.rules
@@ -13,3 +13,4 @@ ACTION=="add", SUBSYSTEM=="spidev", KERNELS=="200c000.*spi", SYMLINK+="apalis-sp
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/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
+
diff --git a/recipes-core/udev/files/toradex-adc.sh b/recipes-core/udev/files/toradex-adc.sh
new file mode 100755
index 0000000..eade822
--- /dev/null
+++ b/recipes-core/udev/files/toradex-adc.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+#
+# Stub script. Just to satisfy the udev recipe.
+
diff --git a/recipes-core/udev/udev-toradex-rules.bb b/recipes-core/udev/udev-toradex-rules.bb
index dc6248a..a4833ca 100644
--- a/recipes-core/udev/udev-toradex-rules.bb
+++ b/recipes-core/udev/udev-toradex-rules.bb
@@ -4,11 +4,14 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda
SRC_URI = "\
file://99-toradex.rules \
file://10-toradex-wifi-ifnames.link \
+ file://toradex-adc.sh \
"
do_install () {
install -d ${D}${sysconfdir}/udev/rules.d
+ install -d ${D}${sysconfdir}/udev/scripts
install -d ${D}${sysconfdir}/systemd/network
install -m 0644 ${WORKDIR}/99-toradex.rules ${D}${sysconfdir}/udev/rules.d/
+ install -m 0755 ${WORKDIR}/toradex-adc.sh ${D}${sysconfdir}/udev/scripts/
install -m 0644 ${WORKDIR}/10-toradex-wifi-ifnames.link ${D}${sysconfdir}/systemd/network/
}