From ThinkWiki
Jump to: navigation, search

Problem with ACPI key event codes in OpenSuse 12.3

The below information was relevant on my Thinkpad Z60m running:

Linux 3.7.10-1.1-desktop
OpenSuse 12.3
KDE 4.10.00 "release 1"

I am currently running:

Linux 3.7.10-1.4-desktop
OpenSuse 12.3
KDE 4.10.2 "release 1"

and everything said below is still valid.

--Jespergoll (talk) 16:20, 9 May 2013 (CEST)

I upgraded my Thinkpad Z60m to OpenSuse 12.3 shortly after its release on March 13th 2013 - and soon found that my ACPI key handling script (/usr/lib/acpid/thinkpad_handler) was broken.

Specifically, they key events reported by the ACPI driver were different from what they had been before the upgrade - and so the following information (in ../Documentation/laptops/thinkpad-acpi.txt) was no longer true on my system:

The driver will report HKEY events in the following format:

  ibm/hotkey HKEY 00000080 0000xxxx

Now, instead, the same HKEY events are generally reported in the following format:

button/xxxxx YYY 00000080 00000000 K

- where "xxxxx" is a lowercase name for either the key or the key function, and YYY is a shorter, capitalized version of the same. For example, Fn-F12 ("suspend to disk") is now being reported as:

button/suspend SUSP 00000080 00000000 K

I have found one exception to this general rule: Fn-F7 (the video switch button) is now being reported as:

video/switchmode VMOD 00000080 00000000 K

So I had to rewrite my key handler script (/usr/lib/acpid/thinkpad_handler), and even the event mask (found in /etc/acpi/events/thinkpad). My general key event mask now looks like this:

action=/usr/lib/acpid/thinkpad_handler "%e"

To get the video switch script back in shape I created an additional event mask (/etc/acpi/events/video) with the following content:

action=/usr/lib/acpid/video_handler "%e"

and moved the video switching routines to a new script: /usr/lib/acpid/video_handler.

Here is a list of the key events I have explored, and the event reports they now produce:

selected ACPI key events
key event name short name constant part note
FnF1 button/fnf1 FNF1 00000080 00000000 K
FnF2 button/battery BAT 00000080 00000000 K 1
FnF3 button/screenlock SCRNLCK 00000080 00000000 K 1
FnF4 button/sleep SBTN 00000080 00000000 K
FnF5 button/wlan WLAN 00000080 00000000 K
FnF6 button/fnf6 FNF6 00000080 00000000 K
FnF7 video/switchmode VMOD 00000080 00000000 K
FnF8 button/zoom ZOOM 00000080 00000000 K 2
FnF9 button/f24 F24 00000080 00000000 K
FnF10 (not reported to handler)
FnF11 button/fnf11 FF11 00000080 00000000 K
FnF12 button/suspend SUSP 00000080 00000000 K
FnSpace button/zoom ZOOM 00000080 00000000 K 2
ThinkVantage button/prog1 PROG1 00000080 00000000 K

  1. Fn-F2 and Fn-F3 seem to have become mixed up in the driver. On my machine at least, Fn-F2 is "lock" and Fn-F3 is "battery".
  2. Please note that Fn-F8 and Fn-Space now produce identical event reports - so there is no way to distinguish one from the other.