[Debian-eeepc-commits] [SCM] Maintenance of eeepc-acpi-scripts debian package branch, master, updated. 1.1.1-22-gd891012
Damyan Ivanov
dmn at debian.org
Mon Aug 10 08:06:27 UTC 2009
The following commit has been merged in the master branch:
commit d8910127d84114f087eb77bb381ddd09c507ca36
Author: Thiemo Nagel <thiemo.nagel at ph.tum.de>
Date: Wed Jul 22 00:26:34 2009 +0200
add support for GSM (3G) toggling
For kernels <= 2.6.30, the "HUAWEI Mobile" device is toggled
via USB power level. For later kernels, the eeepc-wwan3g rfkill
is used through /sys/class/rfkill/rfkillX/state, which does
not (yet) work for 2.6.31-rc3, though. In this case, USB again
is used as a fallback.
diff --git a/debian/changelog b/debian/changelog
index a66e49f..11c44cd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,8 @@ eeepc-acpi-scripts (1.1.2) UNRELEASED; urgency=low
* Blacklist i2c_i801 (not needed, causes a long boot delay).
[ Thiemo Nagel ]
+ * Add support for GSM (3G) toggling, automatically chosing between rfkill
+ and USB methods.
* spelling fix in the default file
* fix actions/wireless.sh usage message
diff --git a/debian/eeepc-acpi-scripts.default b/debian/eeepc-acpi-scripts.default
index f53efff..d45cde3 100644
--- a/debian/eeepc-acpi-scripts.default
+++ b/debian/eeepc-acpi-scripts.default
@@ -91,6 +91,8 @@ BLUETOOTH_FALLBACK_TO_HCITOOL='yes'
# on/off any USB bluetooth adapter found
# - handle_camera_toggle
# Toggles internal camera on/off
+# - handle_gsm_toggle
+# Toggles internal GSM modem (HUAWEI) on/off
# - handle_mute_toggle
# Toggles audio on/off
# - handle_volume_up
diff --git a/etc/acpi/actions/gsm.sh b/etc/acpi/actions/gsm.sh
new file mode 100644
index 0000000..1c106f4
--- /dev/null
+++ b/etc/acpi/actions/gsm.sh
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+# do nothing if package is removed
+PKG=eeepc-acpi-scripts
+FUNC_LIB=/usr/share/$PKG/functions.sh
+[ -e $FUNC_LIB ] || exit 0
+
+. $FUNC_LIB
+
+# first try kernel rfkill
+detect_rfkill eeepc-wwan3g
+if [ -n "$RFKILL" ]; then
+ if echo `cat $RFKILL` > $RFKILL 2> /dev/null; then
+ gsm_control="$RFKILL"
+ gsm_on=1
+ gsm_off=0
+ fi
+fi
+
+# then try USB
+if [ -z "$gsm_control" ]; then
+ for f in /sys/bus/usb/devices/*; do
+ if [ -f "$f/product" ] && grep -q '^HUAWEI Mobile' $f/product; then
+ gsm_control="$f/power/level"
+ gsm_on=auto
+ gsm_off=suspend
+ break
+ fi
+ done
+fi
+
+# give up if no method to toggle GSM was found
+if [ -z "$gsm_control" ]; then
+ echo "GSM control not found."
+ exit 1
+fi
+
+case "$1" in
+ detect)
+ if [ `cat "$gsm_control"` != "$gsm_off" ]; then
+ exit 1
+ else
+ exit 0
+ fi
+ ;;
+ toggle)
+ if [ `cat "$gsm_control"` != "$gsm_off" ]; then
+ echo "$gsm_off" > "$gsm_control"
+ else
+ echo "$gsm_on" > "$gsm_control"
+ fi
+ ;;
+ on|enable|1)
+ echo "$gsm_on" > "$gsm_control"
+ ;;
+ off|disable|0)
+ echo "$gsm_off" > "$gsm_control"
+ ;;
+ *)
+ echo "Usage: $0 [on|off|detect|toggle]"
+ exit 1
+ ;;
+esac
+
diff --git a/etc/acpi/actions/hotkey.sh b/etc/acpi/actions/hotkey.sh
index 6ab038d..4d6ad09 100755
--- a/etc/acpi/actions/hotkey.sh
+++ b/etc/acpi/actions/hotkey.sh
@@ -105,6 +105,16 @@ handle_touchpad_toggle() {
notify touchpad 'Touchpad off'
}
+handle_gsm_toggle() {
+ /etc/acpi/actions/gsm.sh toggle
+ if /etc/acpi/actions/gsm.sh detect; then
+ notify gsm "GSM off"
+ else
+ notify gsm "GSM on"
+ fi
+}
+
+
case $code in
# Fn + key:
# <700/900-series key>/<1000-series key> - function
--
Maintenance of eeepc-acpi-scripts debian package
More information about the Debian-eeepc-commits
mailing list