The attached patch modifies the 3G toggle support to use /dev/rfkill where
available. To test, you'll need eeepc-acpi-scripts git ("rfkill" branch) and,
once you're sure that that's still working, the rfkill package from unstable.

(You can still test even if /dev/rfkill is missing.)

-- 
| Darren Salt            | linux at youmustbejoking | nr. Ashington, | Doon
| using Debian GNU/Linux | or ds    ,demon,co,uk    | Northumberland | Army
| + http://wiki.debian.org/DebianEeePC/

Everything should be transparent to the user.

diff --git a/etc/acpi/actions/gsm.sh b/etc/acpi/actions/gsm.sh
index 1c106f4..f0bd4cb 100644
--- a/etc/acpi/actions/gsm.sh
+++ b/etc/acpi/actions/gsm.sh
@@ -8,13 +8,24 @@ FUNC_LIB=/usr/share/$PKG/functions.sh
 . $FUNC_LIB
 
 # first try kernel rfkill
-detect_rfkill eeepc-wwan3g
+detect_rfkill eeepc-wwan3g wwan
+
 if [ -n "$RFKILL" ]; then
-    if echo `cat $RFKILL` > $RFKILL 2> /dev/null; then
+    if have_dev_rfkill; then
+	gsm_control=wwan
+    elif echo `cat $RFKILL` > $RFKILL 2> /dev/null; then
         gsm_control="$RFKILL"
-        gsm_on=1
-        gsm_off=0
     fi
+
+    get_gsm_rfkill ()
+    {
+	get_rfkill "$RFKILL"
+    }
+
+    set_gsm_rfkill ()
+    {
+	set_rfkill "$RFKILL" "$1"
+    }
 fi
 
 # then try USB
@@ -27,6 +38,20 @@ if [ -z "$gsm_control" ]; then
             break
 	fi
     done
+
+    get_gsm_rfkill ()
+    {
+	[ `cat "$gsm_control"` != "$gsm_off" ] && echo 1 || echo 0
+    }
+
+    set_gsm_rfkill ()
+    {
+	if [ "$1" = 1 ]; then
+            echo "$gsm_off" > "$gsm_control"
+        else
+            echo "$gsm_on" > "$gsm_control"
+        fi
+    }
 fi
 
 # give up if no method to toggle GSM was found
@@ -35,26 +60,20 @@ if [ -z "$gsm_control" ]; then
     exit 1
 fi
 
+STATE="$(get_gsm_rfkill)"
+
 case "$1" in
     detect)
-        if [ `cat "$gsm_control"` != "$gsm_off" ]; then
-            exit 1
-        else
-            exit 0
-        fi
+	exit "$STATE"
 	;;
     toggle)
-        if [ `cat "$gsm_control"` != "$gsm_off" ]; then
-            echo "$gsm_off" > "$gsm_control"
-        else
-            echo "$gsm_on" > "$gsm_control"
-        fi        
+	set_gsm_rfkill $((1-$STATE))
         ;;
     on|enable|1)
-        echo "$gsm_on" > "$gsm_control"
+	set_gsm_rfkill 1
 	;;
     off|disable|0)
-        echo "$gsm_off" > "$gsm_control"
+	set_gsm_rfkill 0
 	;;
     *)
 	echo "Usage: $0 [on|off|detect|toggle]"
_______________________________________________
Debian-eeepc-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/debian-eeepc-devel

Reply via email to