summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]recipes-bsp/multitech/mts-io/mts-io.init25
1 files changed, 25 insertions, 0 deletions
diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init
index 3988932..336f89e 100644..100755
--- a/recipes-bsp/multitech/mts-io/mts-io.init
+++ b/recipes-bsp/multitech/mts-io/mts-io.init
@@ -13,6 +13,7 @@
i2c=/sys/bus/i2c/devices/
GPSCONFIGTYPE="/var/run/config/gpstype"
+DEVTREE="/sys/kernel/config/device-tree/overlays/"
((fail=0))
# To log debug, set LOGDBG to /usr/bin/LOGGER
@@ -48,6 +49,25 @@ sethwtype() {
MTAC_MODULES=$(cd /lib/modules/$(uname -r)/extra/;ls mtac_* 2>/dev/null)
}
+setdevtree() {
+ # add device tree overlays, if they exist.
+ [[ -d /lib/dtoverlays ]] || return 1
+ (
+ cd /lib/dtoverlays
+ for f in $(ls ${hw}*) ; do
+ if ! [[ -d ${DEVTREE} ]] ; then
+ mount configfs
+ fi
+ f1=${f/#${hw}-/}
+ f2=${f1/%.dtbo}
+ # f2 is the extracted device name
+ /bin/mkdir ${DEVTREE}/$f2
+ /bin/cat $f >${DEVTREE}/$f2/dtbo
+ done
+ )
+}
+
+
SYSFS="/usr/sbin/mts-io-sysfs"
LRST="/usr/sbin/mts-util-lora2-reset"
@@ -261,6 +281,7 @@ case $1 in
fi
sethwtype
+ setdevtree
if ((HASAP == 1)) ; then
# install mtac explicitly or any unused modules will cause
@@ -292,6 +313,10 @@ case $1 in
/usr/bin/logger -t "mts-io" -p daemon.err -s "ERROR: Missing ${LRST} -- Cannot initialize LoRa."
fi
fi
+
+ if [[ -d ${DEVTREE} ]] ; then
+ /bin/umount configfs
+ fi
if ((fail == 0)) ; then
echo "OK"