summaryrefslogtreecommitdiff
path: root/recipes-kernel/rs9113/files/immunity/tworadio.sh
diff options
context:
space:
mode:
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
+