summaryrefslogtreecommitdiff
path: root/recipes-connectivity
diff options
context:
space:
mode:
authorBrandon Bayer <bbayer@multitech.com>2017-02-07 11:42:36 -0600
committerJohn Klug <john.klug@multitech.com>2017-02-24 18:11:20 -0600
commit2422d1b225b71cc97c416d2876ab62c4b388804e (patch)
tree8d0946e9da36f3bf500dc96b8923b10d21e399d9 /recipes-connectivity
parent3a42594870353f447dbbdafd6e1602fc64dd8d48 (diff)
downloadmeta-mlinux-2422d1b225b71cc97c416d2876ab62c4b388804e.tar.gz
meta-mlinux-2422d1b225b71cc97c416d2876ab62c4b388804e.tar.bz2
meta-mlinux-2422d1b225b71cc97c416d2876ab62c4b388804e.zip
mtcap:feat: use same network server setup as mtcdt
Diffstat (limited to 'recipes-connectivity')
-rwxr-xr-xrecipes-connectivity/lora/lora-network-server/lora-network-server.init29
1 files changed, 18 insertions, 11 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"