diff options
| -rwxr-xr-x | recipes-connectivity/lora/lora-network-server/lora-network-server.init | 29 | ||||
| -rw-r--r-- | recipes-core/images/mlinux-mtcap-image.bb | 9 | 
2 files changed, 23 insertions, 15 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 c3b332d..70cc1f9 100755 --- a/recipes-connectivity/lora/lora-network-server/lora-network-server.init +++ b/recipes-connectivity/lora/lora-network-server/lora-network-server.init @@ -32,42 +32,49 @@ lora_mtac_id="MTAC-LORA"  lora_1_0_hw="MTAC-LORA-1.0"  lora_1_5_h_hw="MTAC-LORA-1.5" +lora_mtcap_id="MTCAP-LORA" -read_card_info() { +read_lora_hw_info() {      # product-id of first lora card      lora_id=$(mts-io-sysfs show lora/product-id 2> /dev/null)      lora_eui=$(mts-io-sysfs show lora/eui 2> /dev/null)      # remove all colons -    lora_eui_raw=${lora_eui//:/} +    lora_eui_raw=${lora_eui//:}      lora_hw=$(mts-io-sysfs show lora/hw-version 2> /dev/null)  } -card_found() { +hardware_found() { +    # MTCDT only      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          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  +        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 -        diff $GLOBAL_CONF /opt/lora/global_conf.json &>/dev/null -        if [ $? -ne 0 ]; then  +        diff $GLOBAL_CONF /opt/lora/global_conf.json &> /dev/null +        if [ $? -ne 0 ]; then              cp $GLOBAL_CONF /opt/lora/global_conf.json          fi          return 0 +    elif [[ "$lora_id" =~ "$lora_mtcap_id" ]]; then +        # currently only one valid global_conf.json +        ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd +        return 0      else +        echo Lora hardware not detected          return 1      fi  } @@ -76,7 +83,7 @@ card_found() {  do_start() {      mkdir -p $run_dir/1 -    read_card_info +    read_lora_hw_info      if ! [ -f $conf_file ]; then          echo "$0: $conf_file missing" @@ -84,10 +91,10 @@ do_start() {      fi -    if card_found; then +    if hardware_found; then          echo "Found $lora_id with $lora_hw hardware"      else -        echo "$0: MTAC-LORA not detected" +        echo "$0: Lora hardware not detected"          exit 1      fi      echo -n "Starting $NAME: " @@ -98,7 +105,7 @@ do_start() {          --lora-path $run_dir --db $conf_db \          --noconsole -l $net_server_log  >> $net_server_log 2>&1"      sleep 2 -    # start packet forwarder                                                             +    # start packet forwarder      /usr/sbin/start-stop-daemon --chdir $run_dir/1 --background --start --make-pidfile \          --pidfile $pkt_fwd_pidfile --startas /bin/bash -- -c "exec $pkt_fwd" diff --git a/recipes-core/images/mlinux-mtcap-image.bb b/recipes-core/images/mlinux-mtcap-image.bb index 610fe08..e1d419b 100644 --- a/recipes-core/images/mlinux-mtcap-image.bb +++ b/recipes-core/images/mlinux-mtcap-image.bb @@ -36,9 +36,11 @@ MULTITECH_FEATURES += " \                   annex-client \                   " -LORA_FEATURES = "lora-packet-forwarder \ -                 lora-packet-forwarder-dbg \ -                 lora-gateway-utils" +IMAGE_INSTALL += "lora-network-server \ +                  lora-gateway-utils \ +                  lora-query \ +                  mosquitto mosquitto-clients \ +                 "  MISC_FEATURES = "minicom lrzsz nano" @@ -46,7 +48,6 @@ MISC_FEATURES = "minicom lrzsz nano"  IMAGE_INSTALL += " \                  ${FILESYSTEM_FEATURES} \                  ${TIME_FEATURES} \ -                ${LORA_FEATURES} \                  ${MISC_FEATURES} \                  " | 
