summaryrefslogtreecommitdiff
path: root/recipes-kernel/rs9113/files/immunity/tworadio.sh
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2020-11-11 16:17:52 -0600
committerJohn Klug <john.klug@multitech.com>2020-11-11 16:17:52 -0600
commit4bb6f26b05450777d14aa96e10783066c2503dc2 (patch)
tree3ed6c4bb86736d28926fd37a3c2b4eb81de44c82 /recipes-kernel/rs9113/files/immunity/tworadio.sh
downloadmeta-multitech-atmel-5.3.0a.tar.gz
meta-multitech-atmel-5.3.0a.tar.bz2
meta-multitech-atmel-5.3.0a.zip
Add new BSP submodule for Atmel Processors.5.3.0b5.3.0a
Diffstat (limited to 'recipes-kernel/rs9113/files/immunity/tworadio.sh')
-rwxr-xr-xrecipes-kernel/rs9113/files/immunity/tworadio.sh58
1 files changed, 58 insertions, 0 deletions
diff --git a/recipes-kernel/rs9113/files/immunity/tworadio.sh b/recipes-kernel/rs9113/files/immunity/tworadio.sh
new file mode 100755
index 0000000..1ce3640
--- /dev/null
+++ b/recipes-kernel/rs9113/files/immunity/tworadio.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# Environmental variables:
+# BTADDR Bluetooth MAC address
+# BTCHAN Bluetooth Channel
+# WIFIURL WiFi test Address
+# WIFIFILE WiFi
+# WPA_CONFIG Config file for wpa_supplicant.
+#
+BTPIDFILE=/opt/immunity/btpid
+PGRP=$(ps --no-headings -o pgrp $$ | sed -r 's/[[:space:]]//g')
+trap "kill -15 -${PGRP}" EXIT
+HOME=/home/root
+INTERFACES=/etc/network/interfaces
+
+if [[ $1 == wifisetup ]] ; then
+ wifisetup=true
+else
+ wifisetup=false
+fi
+. /etc/default/rs9113
+
+if [[ $COEX_MODE != 5 ]] ; then
+ sed -i 's/^COEX_MODE=[0-9]*/COEX_MODE=5/' /etc/default/rs9113
+fi
+if ! egrep 'auto[[:space:]]+wifi0' $INTERFACES ; then
+ echo '# Added for wifi testing -- tworadio.sh' >> $INTERFACES
+ echo 'auto wifi0' >> $INTERFACES
+fi
+
+if ! egrep 'iface[[:space:]]+wifi0' $INTERFACES ; then
+ echo '# Added for wifi testing -- tworadio.sh' >> $INTERFACES
+ echo 'iface wifi0 inet dhcp' >> $INTERFACES
+fi
+
+/etc/init.d/rs9113 restart
+rm -f btpid
+sleep 5
+
+echo 'Starting bluetooth -- this may take a while'
+if ! $wifisetup ; then
+ /opt/immunity/bluetoothXfer.sh $BTADDR $BTCHAN &
+fi
+BTPID=$!
+while [[ $BTPID != $(cat $BTPIDFILE 2>/dev/null) ]] ; do
+ sleep 1
+done
+echo
+echo 'Bluetooth set up, now set up WiFi'
+if $wifisetup ; then
+ /opt/immunity/wifiXfer.sh wifisetup
+else
+ /opt/immunity/wifiXfer.sh "$WIFIURL" "$WIFIFILE" &
+fi
+WIFIPID=$!
+wait $BTPID
+wait $WIFIPID
+