summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2017-05-24 08:22:01 -0500
committerJohn Klug <john.klug@multitech.com>2017-07-05 11:18:41 -0500
commit833fcef2b8a20857d35478399aa34364fd35b689 (patch)
treea9036e9274386f9b20f090252fb7ed6e1056c959
parent866dd28e27f71309ace0510f83f8cdfaa465d277 (diff)
downloadmeta-mlinux-833fcef2b8a20857d35478399aa34364fd35b689.tar.gz
meta-mlinux-833fcef2b8a20857d35478399aa34364fd35b689.tar.bz2
meta-mlinux-833fcef2b8a20857d35478399aa34364fd35b689.zip
lora: update lora-packet-forwarder init script to create symlinks correctly
-rwxr-xr-xrecipes-connectivity/lora/lora-packet-forwarder/mtcdt/lora-packet-forwarder.init42
1 files changed, 30 insertions, 12 deletions
diff --git a/recipes-connectivity/lora/lora-packet-forwarder/mtcdt/lora-packet-forwarder.init b/recipes-connectivity/lora/lora-packet-forwarder/mtcdt/lora-packet-forwarder.init
index 510f171..396b291 100755
--- a/recipes-connectivity/lora/lora-packet-forwarder/mtcdt/lora-packet-forwarder.init
+++ b/recipes-connectivity/lora/lora-packet-forwarder/mtcdt/lora-packet-forwarder.init
@@ -33,20 +33,38 @@ read_card_info() {
lora_hw=$(mts-io-sysfs show lora/hw-version 2> /dev/null)
}
-
-card_found() {
- if [ -d $port1 ] && [[ $(cat $port1/hw-version) = $lora_hw ]]; then
- ln -sf /dev/spidev32766.2 /dev/spidev0.0
+card_found() {
+ if [ -d $port1 ] && [[ $(cat $port1/hw-version) = $lora_hw ]]; then
+ ln -sf /dev/spidev32766.2 /dev/spidev0.0
elif [ -d $port2 ] && [[ $(cat $port2/hw-version) = $lora_hw ]]; then
ln -sf /dev/spidev32765.2 /dev/spidev0.0
- fi
-
- if [[ "$lora_id" =~ "$lora_mtac_id" ]]; then
- return 0
- else
- return 1
- fi
-}
+ fi
+
+ if [[ "$lora_id" =~ "$lora_mtac_id" ]]; then
+ GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_1_0
+ if [ "$lora_hw" = "$lora_1_0_hw" ] && [[ ! "$lora_id" =~ .*-SPI ]]; then
+ ln -sf /opt/lora/basic_pkt_fwd-usb $pkt_fwd
+ else
+ if [ "$lora_hw" = "$lora_1_5_h_hw" ]; then
+ GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_1_5
+ fi
+ ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd
+ fi
+
+ # ignore error of diff command
+ set +e
+ diff $GLOBAL_CONF /opt/lora/global_conf.json 1>/dev/null
+ if [ $? -ne 0 ]; then
+ cp $GLOBAL_CONF /opt/lora/global_conf.json
+ fi
+ set -e
+
+ return 0
+ else
+ echo MTAC_LORA not detected
+ return 1
+ fi
+}
do_start() {