summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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() {