[Debian-eeepc-commits] [SCM] Maintenance of eeepc-acpi-scripts debian package branch, master, updated. 1.1.5-3-g91411ea

Darren Salt linux at youmustbejoking.demon.co.uk
Fri Dec 18 19:03:36 UTC 2009


The following commit has been merged in the master branch:
commit ea16f4c5ed70000021b2e94d15f4a6ec554c3cd9
Author: Darren Salt <linux at youmustbejoking.demon.co.uk>
Date:   Fri Dec 18 18:59:59 2009 +0000

    Add support for ACPI button/* & video/* events; handle related model specifics.
    
    It has been reported that, for newer kernels on some hw (1002HA, for
    example), hotkey events aren't reported. On my 901, the hotkey events are
    *also* reported *but* there are two keys (third and fourth silver keys) for
    which only hotkey events are reported. The default is to assume that both
    event types are reported; the two known keys for which this doesn't happen
    are currently special-cased. (This is expected to break at some point.)
    
    There's (so far) one button event which is reported for different keys on
    different models. This is handled via the product name (sysfs, DMI).

diff --git a/debian/changelog b/debian/changelog
index 4161459..377d0fe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,15 @@
 eeepc-acpi-scripts (1.1.6) UNRELEASED; urgency=low
 
+  * Add support for ACPI button/* and video/* events.
+    - It is possible that only these will be reported, but it is also
+      possible that both these and hotkey events will be reported; and there
+      are keys for which only hotkey events are reported (it is expected
+      that this will change).
+    - This is incomplete: no known button or video events for Fn-F3 & Fn-F7.
+    - There is one button/* event which is reported for two different keys,
+      fortunately on different models. Disambiguation is done via the
+      product name (requires DMI support, which is normally enabled).
+
  -- Darren Salt <linux at youmustbejoking.demon.co.uk>  Fri, 18 Dec 2009 16:48:05 +0000
 
 eeepc-acpi-scripts (1.1.5) unstable; urgency=high
diff --git a/etc/acpi/actions/hotkey.sh b/etc/acpi/actions/hotkey.sh
index 0edea65..dfaea51 100755
--- a/etc/acpi/actions/hotkey.sh
+++ b/etc/acpi/actions/hotkey.sh
@@ -12,11 +12,36 @@ case $(runlevel) in
 	;;
 esac
 
+BACKLIGHT=/sys/class/backlight/eeepc/brightness
 if [ -e "$DEFAULT" ]; then . "$DEFAULT"; fi
 . $FUNC_LIB
 
 . /etc/acpi/lib/notify.sh
 code=$3
+value=$(test "$0" = - && cat "$BACKLIGHT" || echo "0x$3")
+
+# In case keys are doubly-reported as hotkey and something else.
+# It's random (and irrelevant) which is seen first.
+acpi=
+acpiwrite=
+ACPITEST=/lib/init/rw/eeepc-acpi-scripts.acpi-ignore
+case "$code" in
+    # Soft buttons 3 & 4 are special.
+    # They're always reported as hotkeys (901, at least).
+    # This will probably break when button events are added for these keys.
+    0000001[cd])
+	;;
+    *)
+	if test -f "$ACPITEST"; then
+	    read acpi <"$ACPITEST"
+	else
+	    acpiwrite=$(test "x$1" = x- && echo hotkey || echo -)
+	fi
+	test "$1" = "$acpi" && exit 0
+	;;
+esac
+
+seen_hotkey() { test "$acpi" = button; }
 
 handle_mute_toggle() {
     /etc/acpi/actions/volume.sh toggle
@@ -87,7 +112,7 @@ handle_camera_toggle() {
 
 show_brightness() {
     # final digit of ACPI code is brightness level in hex
-    level=$((0x$code & 0xF))
+    level=$(($value & 0xF))
     # convert hex digit to percent
     percent=$(((100 * $level + 8) / 15))
     notify brightness "Brightness $percent%" fast
@@ -118,6 +143,23 @@ handle_gsm_toggle() {
     fi
 }
 
+# Handle events which we're handling differently on different modelsz
+case $(cat /sys/class/dmi/id/product_name) in
+    [79]*|1000H)
+	case $code in
+	    ZOOM)
+		code=0000001b # soft button 2
+		;;
+	esac
+	;;
+    *)
+	case $code in
+	    ZOOM)
+		code=00000038 # Fn-F4
+		;;
+	esac
+	;;
+esac
 
 case $code in
     # Fn + key:
@@ -128,7 +170,7 @@ case $code in
     # (not a hotkey, not handled here)
 
     # F2/F2 - toggle wireless
-    0000001[01])
+    0000001[01]|WLAN)
 	notify wireless 'Wireless ...'
 	if grep -q '^H.*\brfkill\b' /proc/bus/input/devices; then
 	  :
@@ -149,7 +191,7 @@ case $code in
 	;;
 
     # --/F4 - resolution change
-    00000038)
+    00000038) # ZOOM
 	if [ "${FnF_RESCHANGE}" != 'NONE' ]; then
 	    $FnF_RESCHANGE
 	fi
@@ -157,7 +199,7 @@ case $code in
 
     # F3/F5 - decrease brightness
     # F4/F6 - increase brightness
-    0000002?)
+    0000002?|BRTDN|BRTUP)
 	# actual brightness change is handled in hardware
 	if [ "x$ENABLE_OSD_BRIGHTNESS" != "xno" ]; then
 	  show_brightness
@@ -172,35 +214,35 @@ case $code in
 	;;
 
     # F5/F8 - toggle VGA
-    0000003[012])
+    0000003[012]|VMOD)
 	if [ "${FnF_VGATOGGLE}" != 'NONE' ]; then
 	    ${FnF_VGATOGGLE:-handle_vga_toggle}
 	fi
 	;;
 
     # F6/F9 - 'task manager' key
-    00000012)
+    00000012|PROG1)
 	if [ "${FnF_TASKMGR:-NONE}" != 'NONE' ]; then
 	    $FnF_TASKMGR
 	fi
 	;;
 
     # F7/F10 - mute/unmute speakers
-    00000013)
+    00000013|MUTE)
 	if [ "${FnF_MUTE}" != 'NONE' ]; then
 	    ${FnF_MUTE:-handle_mute_toggle}
 	fi
 	;;
 
     # F8/F11 - decrease volume
-    00000014)
+    00000014|VOLDN)
 	if [ "${FnF_VOLUMEDOWN}" != 'NONE' ]; then
 	    ${FnF_VOLUMEDOWN:-handle_volume_down}
 	fi
 	;;
 
     # F9/F12 - increase volume
-    00000015)
+    00000015|VOLUP)
 	if [ "${FnF_VOLUMEUP}" != 'NONE' ]; then
 	    ${FnF_VOLUMEUP:-handle_volume_up}
 	fi
@@ -212,14 +254,14 @@ case $code in
     # Silver keys, left to right
 
     # Soft button 1
-    0000001a)
+    0000001a|SCRNLCK)
 	if [ "${SOFTBTN1_ACTION}" != 'NONE' ]; then
 	    ${SOFTBTN1_ACTION:-handle_blank_screen}
 	fi
 	;;
 
     # Soft button 2
-    0000001b)
+    0000001b) # ZOOM
 	if [ "${SOFTBTN2_ACTION}" != 'NONE' ]; then
 	    ${SOFTBTN2_ACTION}
 	fi
@@ -230,6 +272,7 @@ case $code in
 	if [ "${SOFTBTN3_ACTION}" != 'NONE' ]; then
 	    ${SOFTBTN3_ACTION:-handle_camera_toggle}
 	fi
+	acpiwrite=
 	;;
 
     # Soft button 4
@@ -237,6 +280,9 @@ case $code in
 	if [ "${SOFTBTN4_ACTION}" != 'NONE' ]; then
 	    ${SOFTBTN4_ACTION:-handle_bluetooth_toggle}
 	fi
+	acpiwrite=
 	;;
 
 esac
+
+test "$acpiwrite" = '' || echo "$acpiwrite" >"$ACPITEST"
diff --git a/etc/acpi/events/hotkey-button b/etc/acpi/events/hotkey-button
new file mode 100644
index 0000000..0a9a859
--- /dev/null
+++ b/etc/acpi/events/hotkey-button
@@ -0,0 +1,2 @@
+event=button/(wlan|zoom|mute|volume|prog)
+action=/etc/acpi/actions/hotkey.sh - %e
diff --git a/etc/acpi/events/hotkey-video b/etc/acpi/events/hotkey-video
new file mode 100644
index 0000000..66307f5
--- /dev/null
+++ b/etc/acpi/events/hotkey-video
@@ -0,0 +1,2 @@
+event=video/(brightness|switchmode)
+action=/etc/acpi/actions/hotkey.sh - %e

-- 
Maintenance of eeepc-acpi-scripts debian package



More information about the Debian-eeepc-commits mailing list