diff options
author | Harsh Sharma <harsh.sharma@multitech.com> | 2018-07-19 15:02:01 -0500 |
---|---|---|
committer | Harsh Sharma <harsh.sharma@multitech.com> | 2018-07-19 15:02:01 -0500 |
commit | f726b5a5528a385d22ee4e1d7d0adce92ab40fad (patch) | |
tree | d1aac8fe4b971bfbb79e013a969dc2c417cae2f2 | |
parent | 3a994b35b6a9e794eca6551b7d18b5deec634743 (diff) | |
download | meta-mlinux-f726b5a5528a385d22ee4e1d7d0adce92ab40fad.tar.gz meta-mlinux-f726b5a5528a385d22ee4e1d7d0adce92ab40fad.tar.bz2 meta-mlinux-f726b5a5528a385d22ee4e1d7d0adce92ab40fad.zip |
Updated pkf init script to fix mtcdt /var/lora/config file not being detected
-rwxr-xr-x | recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init | 43 |
1 files changed, 39 insertions, 4 deletions
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 d94d4dc..5ca2da9 100755 --- a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init +++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init @@ -25,6 +25,12 @@ lora_1_0_hw="MTAC-LORA-1.0" lora_1_5_h_hw="MTAC-LORA-1.5" lora_2_1_hw="MTAC-LORA-2.1" +lora_mtac_id="MTAC-LORA" +lora_mtac_id915="MTAC-LORA-915" +lora_mtac_id868="MTAC-LORA-868" +lora_mtac_h_id915="MTAC-LORA-H-915" +lora_mtac_h_id868="MTAC-LORA-H-868" + lora_mtcap_id="MTCAP-LORA" lora_mtcap_id868="MTCAP-LORA-868" lora_mtcap_id915="MTCAP-LORA-915" @@ -65,11 +71,39 @@ setup_mtcdt() { elif [ -d $port2 ] && [[ $(cat $port2/hw-version) = $lora_hw ]]; then ln -sf /dev/spidev32765.2 /dev/spidev0.0 fi + if [ "$lora_hw" = "$lora_1_0_hw" ] && [[ ! "$lora_id" =~ .*-SPI ]]; then + if [ "$lora_id" = "$lora_mtac_id868" ]; then + GLOBAL_CONF=/opt/lora/global_conf.json.MTCDT_LORA_1_0.EU868 + elif [ "$lora_id" = "$lora_mtac_id915" ]; then + GLOBAL_CONF=/opt/lora/global_conf.json.MTCDT_LORA_1_0.US915 + else + echo "No valid configuration found for mtcdt exiting." + exit 1 + fi ln -sf /opt/lora/basic_pkt_fwd-usb $pkt_fwd else + if [ "$lora_id" = "$lora_mtac_h_id868" ]; then + GLOBAL_CONF=/opt/lora/global_conf.json.MTCDT_LORA_1_5.EU868 + elif [ "$lora_id" = "$lora_mtac_h_id915" ]; then + GLOBAL_CONF=/opt/lora/global_conf.json.MTCDT_LORA_1_5.US915 + else + echo "No valid configuration found for mtcdt exiting." + exit 1 + fi ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd fi + + opt_conf_file=$opt_conf_dir/global_conf.json + opt_conf_file_local=$opt_conf_dir/local_conf.json + + cp $GLOBAL_CONF $opt_conf_file + + if ! [ -f $conf_file ]; then + mkdir -p /var/config/lora/ + cp $opt_conf_file $conf_file + cp $opt_conf_file_local $conf_file_local + fi } setup_mtcap() { @@ -86,7 +120,6 @@ setup_mtcap() { opt_conf_file_local=$opt_conf_dir/local_conf.json cp $GLOBAL_CONF $opt_conf_file - sed -i "s/\"gateway_ID\": \".*\"/\"gateway_ID\": \"$lora_eui_raw\"/" $opt_conf_file if ! [ -f $conf_file ]; then mkdir -p /var/config/lora/ @@ -102,7 +135,7 @@ setup_mtcdt_2_1() { GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_2_1_loc_single_antenna_16ch_EU868 elif [[ "$lora_id" = "$lora_mtac_g16_id915" ]]; then GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_2_1_loc_single_antenna_16ch_US915 - elif [[ "$lora_id" = "$lora_mtac_g16_id868" ]]; then + elif [[ "$lora_id" = "$lora_mtac_g64_id868" ]]; then GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_2_1_test_single_antenna_64ch_8x8_EU868 elif [[ "$lora_id" = "$lora_mtac_g64_id915" ]]; then GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_2_1_loc_single_antenna_64ch_US915 @@ -111,9 +144,8 @@ setup_mtcdt_2_1() { fi opt_conf_file=$opt_conf_dir/global_conf.json - cp $GLOBAL_CONF $opt_conf_file - sed -i "s/\"gateway_ID\": \".*\"/\"gateway_ID\": \"$lora_eui_raw\"/" $opt_conf_file + cp $GLOBAL_CONF $opt_conf_file if ! [ -f $conf_file ]; then mkdir -p /var/config/lora/ @@ -152,8 +184,11 @@ do_start() { cp $conf_file $run_dir/1/ if [ -f $conf_file_local ]; then cp $conf_file_local $run_dir/1/ + sed "s/\(.*gateway_ID\"\s*\:\s*\"\)<.*>[^\"]*\(.*\)/\1${lora_eui_raw}\2/g" /var/run/lora/1/local_conf.json fi + sed "s/\(.*gateway_ID\"\s*\:\s*\"\)<.*>[^\"]*\(.*\)/\1${lora_eui_raw}\2/g" /var/run/lora/1/global_conf.json + # # start packet forwarder # |