summaryrefslogtreecommitdiff
path: root/recipes-connectivity
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2017-05-24 08:22:01 -0500
committerJohn Klug <john.klug@multitech.com>2017-05-24 17:30:48 -0500
commit7cfb6251023585a9501a62a6b1f7b0114538fbc6 (patch)
tree78af2aea6dcee349a2c0356d07a676820be11386 /recipes-connectivity
parentb899b63783a7e8fe431f2661d449f98e4555f16a (diff)
downloadmeta-mlinux-7cfb6251023585a9501a62a6b1f7b0114538fbc6.tar.gz
meta-mlinux-7cfb6251023585a9501a62a6b1f7b0114538fbc6.tar.bz2
meta-mlinux-7cfb6251023585a9501a62a6b1f7b0114538fbc6.zip
lora: update lora-packet-forwarder init script to create symlinks correctly
Diffstat (limited to 'recipes-connectivity')
-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() {