op_wifi.sh: Basic script to toggle internal WiFi on / off
authorMichael Mrozek <EvilDragon@openpandora.org>
Fri, 9 Apr 2010 03:01:08 +0000 (05:01 +0200)
committerMichael Mrozek <EvilDragon@openpandora.org>
Fri, 9 Apr 2010 03:01:08 +0000 (05:01 +0200)
recipes/pandora-system/pandora-scripts/op_wifi.sh

index 3f2c65b..d89e7cd 100644 (file)
@@ -1,34 +1,15 @@
-#!/bin/bash
-#get value range
-minmhz=14
-safemhz=600
-maxmhz=900
-curmhz=$(cat /proc/pandora/cpu_mhz_max)
-device=/proc/pandora/cpu_mhz_max
-if [ ! $1 ]; then
-       if [ $DISPLAY ]; then
-               newmhz=$(zenity --scale --text "set cpu mhz" --min-value=$minmhz --max-value=$maxmhz --value=$curmhz --step 1)
-       else
-               newmhz=$(read -p "Pleas enter the desired speed")
-       fi
+#!/bin/sh
+#
+# Released under the GPL
+
+# This script simply toggles internal WiFi on or off.
+
+if [ "`lsmod | grep wl1251`" ]
+then
+       notify-send -u normal "WLAN" "WLAN is being disabled..." -i /usr/share/icons/hicolor/32x32/apps/nm-no-connection.png
+       ifconfig wlan0 down
+       rmmod board_omap3pandora_wifi wl1251_sdio wl1251
 else
-newmhz=$1
+       notify-send -u normal "WLAN" "WLAN is being enabled..." -i /usr/share/icons/hicolor/32x32/apps/nm-device-wired.png
+       /etc/init.d/wl1251-init start
 fi
-if [ $newmhz ]; then
-        if [ $newmhz -ge $safemhz ]; then
-                if [ $DISPLAY ]; then
-                        answer=$(zenity --question --title "Alert" --text "You are trying to set the cpu clock to $newmhz which is above its specification of $safemhz, doing so may burn down your house, sour milk, or just blow up (ok, not that likely)! proceed?";echo $?)
-                        echo $answer
-                        if [ $answer = 1 ]; then exit 1; fi
-                else
-                       answer="n";read -p "You are trying to set the cpu clock to $newmhz which is above its specification of $safemhz, doing so may burn down your house, sour milk, or just blow up (ok, not that likely)! proceed? [y/n]" -t 10 answer
-                       echo $answer
-                       if [ $answer = n ]; then exit 1; fi
-                fi
-        fi
-        if [ $newmhz -le $minmhz ]; then newmhz=$minmhz; fi
-        if [ $newmhz -ge $maxmhz ]; then newmhz=$maxmhz; fi
-fi
-echo $newmhz > $device
-echo cpu_mhz_max set to $(cat /proc/pandora/cpu_mhz_max)