diff --git a/debian/eeepc-acpi-scripts.default b/debian/eeepc-acpi-scripts.default index 8fe4a7c..55e7c79 100644 --- a/debian/eeepc-acpi-scripts.default +++ b/debian/eeepc-acpi-scripts.default @@ -1,5 +1,5 @@ # by default OSD output of function keys is disabled because it's too slow -# set to yes if you want fancy osd overlayS +# set to yes if you want fancy osd overlays ENABLE_OSD='no' OSD_FONT='DejaVuSans 36' @@ -87,6 +87,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 100755 index 0000000..d4e1126 --- /dev/null +++ b/etc/acpi/actions/gsm.sh @@ -0,0 +1,56 @@ +#! /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 + +detect_rfkill eeepc-wwan3g +gsm_control="$RFKILL" +if [ -n "$gsm_control" ]; then + gsm_on=1 + gsm_off=0 +else + 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 + if [ -z "$gsm_control" ]; then + echo "GSM control not found." + exit 1 + fi +fi + +case "$1" in + detect) + if [ `cat "$gsm_control"` != "$gsm_off" ]; then + exit 1 + else + exit 0 + fi + ;; + on|enable|1) + echo "$gsm_on" > "$gsm_control" + ;; + off|disable|0) + echo "$gsm_off" > "$gsm_control" + ;; + toggle) + if [ `cat "$gsm_control"` != "$gsm_off" ]; then + echo "$gsm_off" > "$gsm_control" + else + echo "$gsm_on" > "$gsm_control" + fi + ;; + *) + 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 1de5077..8bd326d 100755 --- a/etc/acpi/actions/hotkey.sh +++ b/etc/acpi/actions/hotkey.sh @@ -98,6 +98,16 @@ handle_shengine() { handle_shengine "$@" } +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 diff --git a/etc/acpi/actions/wireless.sh b/etc/acpi/actions/wireless.sh index 617826a..02e8d09 100755 --- a/etc/acpi/actions/wireless.sh +++ b/etc/acpi/actions/wireless.sh @@ -1,6 +1,11 @@ #!/bin/sh -. /usr/share/eeepc-acpi-scripts/functions.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 detect_rfkill eeepc-wlan wlan_control="$RFKILL" @@ -45,7 +50,7 @@ case "$cmd" in fi ;; *) - echo "Usage: $0 [on|off]" + echo "Usage: $0 [on|off|detect]" exit 1 ;; esac