[pisa-src] r1180 - in trunk/tools: auto-handover-tablet.sh trigger-demo-update.sh

  • From: Tobias Heer <tobias.heer@xxxxxxxxxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Thu, 15 Oct 2009 17:07:42 +0200

Author: heer
Date: Thu Oct 15 17:07:41 2009
New Revision: 1180

Log:
Added tablet-specific handover files

Added:
   trunk/tools/auto-handover-tablet.sh   (contents, props changed)
Modified:
   trunk/tools/trigger-demo-update.sh

Added: trunk/tools/auto-handover-tablet.sh
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/tools/auto-handover-tablet.sh Thu Oct 15 17:07:41 2009        (r1180)
@@ -0,0 +1,78 @@
+#!/bin/bash  
+
+echo "This file searches APs with SSID $PATTERN* and switches to the strongest 
signal" 
+
+
+#your parameters
+WIFI_IF="wlan0"
+PATTERN="pisa-testbed"
+AP_IP="192.168.8.1"
+IP="192.168.8.124"
+DEST_NET=192.168.5.0
+
+## internal parameters
+last_result="NONE"
+
+activate_wifi()
+{
+        iwconfig $WIFI_IF essid pisa-testbed-ares
+        ifconfig $WIFI_IF $IP netmask 255.255.255.0
+        route del -net $DEST_NET netmask 255.255.255.0
+        route add -net $DEST_NET netmask 255.255.255.0 gw $AP_IP
+        sleep 1
+}
+
+
+activate_wifi
+
+
+fail_counter=0
+while [ 1 ]
+do
+
+
+result=($(iwlist $WIFI_IF scanning | ./iwlist_parser -s $PATTERN))
+
+
+
+if [ "${result[0]}" == "NONE" ]
+then
+        echo "No PISA access points nearby"
+        fail_counter=$(($fail_counter+1))
+        echo "Increasing module fail counter $fail_counter"     
+        last_result=${result[0]}
+        if [ "$fail_counter" == "5" ]
+        then
+                echo "Restarting kernel modules"
+                rmmod ath9k
+                modprobe ath9k
+                sleep 1
+                fail_counter=0
+                activate_wifi
+        fi
+        sleep 1
+else
+        fail_counter=0
+        if [ "$last_result" != "${result[0]}" ]
+        then
+                echo "Changing to " ${result[1]}
+                #echo iwconfig $WIFI_IF ap  ${result[0]} essid  ${result[1]}
+                #iwconfig $WIFI_IF ap  ${result[0]} essid  ${result[1]}
+                echo iwconfig $WIFI_IF  essid  ${result[1]}
+                iwconfig $WIFI_IF  essid  ${result[1]}
+                arp -d $AP_IP 2> /dev/null
+
+                if [ "$last_result" = "NONE" ]
+                then
+                        ifconfig $WIFI_IF $IP
+                fi
+
+                last_result=${result[0]}
+                sleep 10
+        else
+                echo "Access Point is still best ${result[1]} "${result[2]}
+                sleep 5
+        fi
+
+fi
+done

Modified: trunk/tools/trigger-demo-update.sh
==============================================================================
--- trunk/tools/trigger-demo-update.sh  Thu Oct 15 16:59:37 2009        (r1179)
+++ trunk/tools/trigger-demo-update.sh  Thu Oct 15 17:07:41 2009        (r1180)
@@ -37,9 +37,9 @@
 update_hip
 update_geo_id $1
 
-sleep 1
-update_hip
-sleep 1
-update_geo_id $1
+$(sleep 1; update_hip) &
+
+echo "Associated with $1"
+$(sleep 4; update_geo_id $1 )&
 
 echo Done

Other related posts:

  • » [pisa-src] r1180 - in trunk/tools: auto-handover-tablet.sh trigger-demo-update.sh - Tobias Heer