]> git.donarmstrong.com Git - bin.git/commitdiff
add cycle wireless
authorDon Armstrong <don@donarmstrong.com>
Thu, 6 Dec 2007 03:21:01 +0000 (03:21 +0000)
committerDon Armstrong <don@donarmstrong.com>
Thu, 6 Dec 2007 03:21:01 +0000 (03:21 +0000)
cycle_wireless [new file with mode: 0755]
presentation_mode

diff --git a/cycle_wireless b/cycle_wireless
new file mode 100755 (executable)
index 0000000..90b940e
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+NETWORK="$1"
+WIRELESS="$2"
+
+if [ -z "$NETWORK" ]; then
+       NETWORK="homewlan";
+fi;
+
+if [ -z "$WIRELESS" ]; then
+       WIRELESS="wireless";
+fi;
+
+# First try a minor cycle
+
+ESSID=$(/sbin/iwconfig "$WIRELESS" 2>/dev/null |grep ESSID |perl -ne 'm/\"([^\"]+)\"/ && print $1,qq(\n)')
+
+if [ -n "$ESSID" ]; then
+    sudo iwconfig "$WIRELESS" essid "$ESSID"
+    sleep 1s;
+    if /sbin/iwconfig "$WIRELESS" 2>/dev/null | grep 'Bit Rate'|grep -qv '=1 Mb/s'; then
+       exit 0
+    fi;
+fi;
+
+# Failure, so major cycle
+sudo ifdown wireless;
+if [ "$WIRELESS" == "wireless" ]; then 
+    sudo modprobe -r bcm43xx;
+    sudo modprobe bcm43xx;
+fi;
+sudo ifup "wireless=${NETWORK}";
index c0e583cbb5ac340f8f634295bd20d693ac41dbfc..bda393d366c23618d7b4e7b4b896c64c163b877b 100755 (executable)
@@ -6,13 +6,13 @@
 if [ -n "$1" ]; then
 #    xrandr -s 1024x768
     xrandr -s 800x600
-     xmodmap -e 'keysym Left = p'
-     xmodmap -e 'keysym Right = n'
+#     xmodmap -e 'keysym Left = p'
+#     xmodmap -e 'keysym Right = n'
     killall xscreensaver
 else
     xrandr -s 1440x900
-     xmodmap -e 'keycode 102 = Right'
-     xmodmap -e 'keycode 100 = Left'
+#     xmodmap -e 'keycode 102 = Right'
+#     xmodmap -e 'keycode 100 = Left'
     # XXX test to see if the X screensaver is already running
     /usr/bin/xscreensaver & >/dev/null 2>&1
 fi;
\ No newline at end of file