diff options
Diffstat (limited to 'recipes-connectivity/lora/lora-network-server')
-rwxr-xr-x | recipes-connectivity/lora/lora-network-server/lora-network-server.init | 36 |
1 files changed, 9 insertions, 27 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 d89c06d..0c1ae19 100755 --- a/recipes-connectivity/lora/lora-network-server/lora-network-server.init +++ b/recipes-connectivity/lora/lora-network-server/lora-network-server.init @@ -100,10 +100,10 @@ setup_mtcdt3() { } hardware_found() { - if [[ "$hw_id" =~ "$mtcdt3_id" ]]; then - setup_mtcdt3 - elif [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then + if [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then setup_mtcdt_2_1 + elif [[ "$lora_id" =~ "$lora_mtac_2g4_id" ]]; then + setup_mtcdt_2g4 elif [[ "$lora_id" =~ "$lora_mtac_003_id" ]]; then setup_mtcdt003 elif [[ "$lora_id" =~ "$lora_mtac_id" ]]; then @@ -118,8 +118,6 @@ hardware_found() { } setup_mtcdt_2_1() { - ln -sf /dev/spidev32766.2 /dev/spidev0.0 - if [[ "$lora_id" = "$lora_mtac_g16_id868" ]]; then GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_2_1_loc_single_antenna_16ch_EU868 elif [[ "$lora_id" = "$lora_mtac_g16_id915" ]]; then @@ -190,11 +188,6 @@ setup_mtcap3() { } setup_mtcdt() { - 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 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 @@ -269,14 +262,7 @@ do_start() { if hardware_found; then echo "Found $lora_id with $lora_hw hardware" - if [[ "$hw_id" =~ "$mtcdt3_id" ]]; then - mts-io-sysfs store lora/reset 0 - mts-io-sysfs store lora-2/reset 0 - sleep 0.25 - mts-io-sysfs store lora/reset 1 - mts-io-sysfs store lora-2/reset 1 - sleep 0.25 - elif [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then + if [[ "$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 @@ -316,11 +302,9 @@ do_start() { if [ "$no_lora_hw" != "true" ]; then # start packet forwarder - if [[ "$hw_id" =~ "$mtcdt3_id" ]]; then - sleep 0.5 - else - sleep 4 - fi + + sleep 4 + /usr/sbin/start-stop-daemon --chdir $run_dir/1 --start --background --make-pidfile \ --pidfile $pkt_fwd_pidfile --startas /bin/bash \ -- -c "exec $pkt_fwd $pkt_fwd_options 2>&1" @@ -332,10 +316,8 @@ do_start() { fi fi - if [[ ! "$hw_id" =~ "$mtcdt3_id" ]]; then - renice -n -20 -p $(pgrep lora-network-se) - renice -n -20 -p $(pgrep $(basename $pkt_fwd)) - fi + renice -n -20 -p $(pgrep lora-network-se) + renice -n -20 -p $(pgrep $(basename $pkt_fwd)) echo "OK" } |