summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrecipes-connectivity/lora/lora-network-server/lora-network-server.init69
-rwxr-xr-xrecipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init77
2 files changed, 133 insertions, 13 deletions
diff --git a/recipes-connectivity/lora/lora-network-server/lora-network-server.init b/recipes-connectivity/lora/lora-network-server/lora-network-server.init
index eb13720..d89c06d 100755
--- a/recipes-connectivity/lora/lora-network-server/lora-network-server.init
+++ b/recipes-connectivity/lora/lora-network-server/lora-network-server.init
@@ -33,6 +33,9 @@ lora_1_5_h_hw="MTAC-LORA-1.5"
lora_2_1_hw="MTAC-LORA-2.1"
lora_mtac_id="MTAC-LORA"
+lora_mtac_003_id="MTAC-003"
+lora_mtac_003_id868="MTAC-003E00"
+lora_mtac_003_id915="MTAC-003U00"
lora_mtcap_id="MTCAP-LORA"
lora_mtcap_id868="MTCAP-LORA-868"
@@ -43,6 +46,9 @@ lora_mtcdt3_id="MTCDT3-LORA"
lora_mtcdt3_id868="MTCDT3-LORA-868"
lora_mtcdt3_id915="MTCDT3-LORA-915"
+lora_mtcap3_id="MTCAP3"
+lora_mtcap3_id868="MTCAP3-003E00"
+lora_mtcap3_id915="MTCAP3-003U00"
lora_mtac_g_id="MTAC-LORA-G"
lora_mtac_g16_id868="MTAC-LORA-G16-868"
@@ -63,7 +69,14 @@ read_lora_hw_info() {
# remove all colons
lora_eui_raw=${lora_eui//:}
lora_hw=$(mts-io-sysfs show lora/hw-version 2> /dev/null)
- if [ -d $port2 ] && [[ $(cat $port2/hw-version) =~ "LORA-1.5" ]]; then
+
+ if [ -d $port1 ] && [[ $(cat $port1/hw-version) =~ "LORA-1.5" ]] && [ -d $port2 ] && [[ $(cat $port2/hw-version) =~ "LORA-1.5" ]]; then
+ dual_cards_installed=true
+ elif [ -d $port1 ] && [[ $(cat $port1/hw-version) =~ "MTAC-003" ]] && [ -d $port2 ] && [[ $(cat $port2/hw-version) =~ "MTAC-003" ]]; then
+ dual_cards_installed=true
+ fi
+
+ if [[ "$dual_cards_installed" = "true" ]] && [ -d $port2 ] && [[ $(cat $port2/hw-version) =~ "LORA-1.5" || $(cat $port2/hw-version) =~ "LORA-2G4" || $(cat $port2/hw-version) =~ "MTAC-003" ]]; then
# product-id of first lora card
lora_2_id=$(mts-io-sysfs show lora-2/product-id 2> /dev/null)
lora_2_hw=$(mts-io-sysfs show lora-2/hw-version 2> /dev/null)
@@ -72,9 +85,6 @@ read_lora_hw_info() {
lora_2_eui_raw=${lora_2_eui//:}
fi
- if [ -d $port1 ] && [[ $(cat $port1/hw-version) =~ "LORA-1.5" ]] && [ -d $port2 ] && [[ $(cat $port2/hw-version) =~ "LORA-1.5" ]]; then
- dual_cards_installed=true
- fi
}
setup_mtcdt3() {
@@ -94,8 +104,12 @@ hardware_found() {
setup_mtcdt3
elif [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then
setup_mtcdt_2_1
+ elif [[ "$lora_id" =~ "$lora_mtac_003_id" ]]; then
+ setup_mtcdt003
elif [[ "$lora_id" =~ "$lora_mtac_id" ]]; then
setup_mtcdt
+ elif [[ "$lora_id" =~ "$lora_mtcap3_id" ]]; then
+ setup_mtcap3
elif [[ "$lora_id" =~ "$lora_mtcap_id" ]]; then
setup_mtcap
else
@@ -130,6 +144,51 @@ setup_mtcdt_2_1() {
pkt_fwd_options=" -g"
}
+setup_mtcdt003() {
+ if [[ "$lora_id" =~ "$lora_mtac_003_id868" ]]; then
+ GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_003_0_0.EU868
+ elif [[ "$lora_id" =~ "$lora_mtac_003_id915" ]]; then
+ GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_003_0_0.US915
+ else
+ return 1
+ fi
+
+ ln -sf /opt/lora/lora_pkt_fwd_sx1303 $pkt_fwd
+ ln -sf /opt/lora/lora_pkt_fwd_sx1303 $pkt_fwd_2
+
+ # 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
+}
+
+setup_mtcap3() {
+ if [[ "$lora_id" = "$lora_mtcap3_id868" ]]; then
+ GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP3.EU868
+ elif [[ "$lora_id" = "$lora_mtcap3_id915" ]]; then
+ GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP3.US915
+ else
+ return 1
+ fi
+
+ ln -sf /opt/lora/lora_pkt_fwd_sx1303 $pkt_fwd
+
+ # 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
+}
+
setup_mtcdt() {
if [ -d $port1 ] && [[ $(cat $port1/hw-version) = $lora_hw ]]; then
ln -sf /dev/spidev32766.2 /dev/spidev0.0
@@ -221,7 +280,7 @@ do_start() {
echo Resetting 2.1 LoRa
/usr/sbin/mts-util-lora2-reset -g -f >/dev/null 2>&1
sleep 0.25
- else
+ elif [[ ! "$lora_id" =~ "$lora_mtcap3_id" ]] && [[ ! "$lora_id" =~ "$lora_mtac_003_id" ]]; then
mts-io-sysfs store lora/reset 0
if [ "$dual_cards_installed" == true ]; then
mts-io-sysfs store lora-2/reset 0
diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init
index e475204..092e0a5 100755
--- a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init
+++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init
@@ -41,10 +41,18 @@ mtac_spi_device_2="spidev32765.2"
# spidev32765.2 spidev32766.2
+lora_mtac_003_id="MTAC-003"
+lora_mtac_003_id868="MTAC-003E00"
+lora_mtac_003_id915="MTAC-003U00"
+
lora_mtcap_id="MTCAP-LORA"
lora_mtcap_id868="MTCAP-LORA-868"
lora_mtcap_id915="MTCAP-LORA-915"
+lora_mtcap3_id="MTCAP3"
+lora_mtcap3_id868="MTCAP3-003E00"
+lora_mtcap3_id915="MTCAP3-003U00"
+
mtcdt3_id="MTCDT3"
lora_mtcdt3_id="MTCDT3-LORA"
lora_mtcdt3_id868="MTCDT3-LORA-868"
@@ -72,7 +80,14 @@ read_lora_hw_info() {
# remove all colons
lora_eui_raw=${lora_eui//:}
lora_hw=$(mts-io-sysfs show lora/hw-version 2> /dev/null)
- if [ -d $port2 ] && [[ $(cat $port2/hw-version) =~ "LORA-1.5" ]]; then
+
+ if [ -d $port1 ] && [[ $(cat $port1/hw-version) =~ "LORA-1.5" ]] && [ -d $port2 ] && [[ $(cat $port2/hw-version) =~ "LORA-1.5" ]]; then
+ dual_cards_installed=true
+ elif [ -d $port1 ] && [[ $(cat $port1/hw-version) =~ "MTAC-003" ]] && [ -d $port2 ] && [[ $(cat $port2/hw-version) =~ "MTAC-003" ]]; then
+ dual_cards_installed=true
+ fi
+
+ if [[ "$dual_cards_installed" = "true" ]] && [ -d $port2 ] && [[ $(cat $port2/hw-version) =~ "LORA-1.5" || $(cat $port2/hw-version) =~ "LORA-2G4" || $(cat $port2/hw-version) =~ "MTAC-003" ]]; then
# product-id of first lora card
lora_2_id=$(mts-io-sysfs show lora-2/product-id 2> /dev/null)
lora_2_hw=$(mts-io-sysfs show lora-2/hw-version 2> /dev/null)
@@ -81,9 +96,6 @@ read_lora_hw_info() {
lora_2_eui_raw=${lora_2_eui//:}
fi
- if [ -d $port1 ] && [[ $(cat $port1/hw-version) =~ "LORA-1.5" ]] && [ -d $port2 ] && [[ $(cat $port2/hw-version) =~ "LORA-1.5" ]]; then
- dual_cards_installed=true
- fi
}
hardware_found() {
@@ -91,10 +103,14 @@ hardware_found() {
setup_mtcdt3
elif [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then
setup_mtcdt_2_1
- elif [[ "$lora_id" =~ "$lora_mtcap_id" ]]; then
- setup_mtcap
+ elif [[ "$lora_id" =~ "$lora_mtac_003_id" ]]; then
+ setup_mtcdt003
elif [[ "$lora_id" =~ "$lora_mtac_id" ]]; then
setup_mtcdt
+ elif [[ "$lora_id" =~ "$lora_mtcap3_id" ]]; then
+ setup_mtcap3
+ elif [[ "$lora_id" =~ "$lora_mtcap_id" ]]; then
+ setup_mtcap
else
return 1
fi
@@ -140,6 +156,51 @@ setup_mtcdt3() {
fi
}
+setup_mtcdt003() {
+ if [[ "$lora_id" =~ "$lora_mtac_003_id868" ]]; then
+ GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_003_0_0.EU868
+ elif [[ "$lora_id" =~ "$lora_mtac_003_id915" ]]; then
+ GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_003_0_0.US915
+ else
+ return 1
+ fi
+
+ ln -sf /opt/lora/lora_pkt_fwd_sx1303 $pkt_fwd
+ ln -sf /opt/lora/lora_pkt_fwd_sx1303 $pkt_fwd_2
+
+ # 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
+}
+
+setup_mtcap3() {
+ if [[ "$lora_id" = "$lora_mtcap3_id868" ]]; then
+ GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP3.EU868
+ elif [[ "$lora_id" = "$lora_mtcap3_id915" ]]; then
+ GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP3.US915
+ else
+ return 1
+ fi
+
+ ln -sf /opt/lora/lora_pkt_fwd_sx1303 $pkt_fwd
+
+ # 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
+}
+
setup_mtcdt() {
if [ -d $port1 ] && [[ $(cat $port1/hw-version) = $lora_hw ]]; then
ln -sf /dev/spidev32766.2 /dev/spidev0.0
@@ -275,8 +336,8 @@ do_start() {
elif [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then
echo Resetting 2.1 LoRa
/usr/sbin/mts-util-lora2-reset -g -f >/dev/null 2>&1
- sleep 0.25
- else
+ sleep 0.25
+ elif [[ ! "$lora_id" =~ "$lora_mtcap3_id" ]] && [[ ! "$lora_id" =~ "$lora_mtac_003_id" ]]; then
mts-io-sysfs store lora/reset 0
if [ "$dual_cards_installed" == true ]; then
mts-io-sysfs store lora-2/reset 0