summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Gilles <jgilles@multitech.com>2015-04-27 13:49:25 -0500
committerJesse Gilles <jgilles@multitech.com>2015-04-27 13:49:25 -0500
commit2649fb6602531e43eeac8f08b6326cb538babad7 (patch)
tree16da90c19862b7f45924e40395089d8f0727230e
parent4091fe68514a5c1522210f33ed8cf95e069f7b83 (diff)
downloadmeta-multitech-2649fb6602531e43eeac8f08b6326cb538babad7.tar.gz
meta-multitech-2649fb6602531e43eeac8f08b6326cb538babad7.tar.bz2
meta-multitech-2649fb6602531e43eeac8f08b6326cb538babad7.zip
mts-io: create /dev links for MTAC-MFSER cards
-rw-r--r--recipes-bsp/multitech/mts-io.inc2
-rw-r--r--recipes-bsp/multitech/mts-io/mts-io.init39
2 files changed, 39 insertions, 2 deletions
diff --git a/recipes-bsp/multitech/mts-io.inc b/recipes-bsp/multitech/mts-io.inc
index 47e9cae..0b65380 100644
--- a/recipes-bsp/multitech/mts-io.inc
+++ b/recipes-bsp/multitech/mts-io.inc
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://io-module/COPYING;md5=94d55d512a9ba36caa9b7df079bae19
file://io-tool/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
"
DEPENDS = "virtual/kernel"
-INC_PR = "r6"
+INC_PR = "r7"
SRCREV = "${PV}"
diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init
index 77dd0e2..f27415c 100644
--- a/recipes-bsp/multitech/mts-io/mts-io.init
+++ b/recipes-bsp/multitech/mts-io/mts-io.init
@@ -1,9 +1,46 @@
-#!/bin/sh
+#!/bin/bash
+
+sysdir=/sys/devices/platform/mts-io
+
+read_card_info() {
+ ap1_product_id=""
+ ap2_product_id=""
+
+ if [ -d $sysdir/ap1 ]; then
+ ap1_product_id=$(cat $sysdir/ap1/product-id)
+ fi
+ if [ -d $sysdir/ap2 ]; then
+ ap2_product_id=$(cat $sysdir/ap2/product-id)
+ fi
+}
+
+mfser_init() {
+ found_ap1=0
+
+ if [[ "$ap1_product_id" =~ ^MTAC-MFSER- ]]; then
+ echo "mts-io: Linking /dev/mfser to /dev/ttyAP1"
+ ln -sf /dev/ttyAP1 /dev/mfser
+ found_ap1=1
+ fi
+
+ if [[ "$ap2_product_id" =~ ^MTAC-MFSER- ]]; then
+ if [[ $found_ap1 = 1 ]]; then
+ echo "mts-io: Linking /dev/mfser-2 to /dev/ttyAP2"
+ ln -sf /dev/ttyAP2 /dev/mfser-2
+ else
+ echo "mts-io: Linking /dev/mfser to /dev/ttyAP2"
+ ln -sf /dev/ttyAP2 /dev/mfser
+ fi
+ fi
+
+}
case $1 in
start)
echo "Loading mts-io module"
modprobe mts_io
+ read_card_info
+ mfser_init
;;
stop)