Keycode/hal events for laptop keys
We have done KubuntuLaptopButtons spec for Edgy and would like to improve it even further for Feisty (see KubuntuFeistyLaptop) and would like to get more reports on keycodes and HAL events from laptop users.
Please add your notebook (with your nick) to this table - if you have a key which is not listed yet, please add new row. If you get report, put it into table in following format: keycode / event:
Key |
XF86 keysym |
HP nw8240 |
Toshiba A10 Satellite |
Maxdata ECO4500A |
Prestigio Visconte 1200 |
Dell Latitude D600 |
Acer Travelmate 8100 |
Dell Inspiron 6400 |
Airis Signum AG-408S (Desktop) |
Dell Inspiron 5100 |
Compaq Presario C304NR |
Apple iBook G4 |
ASUS A6KmQ007H |
DELL Inspiron 640m |
Acer Travelmate 3212WXWmi |
Fujitsu-Siemens Amilo Pro V3505 |
Apple Macbook Pro |
"Dell Inspiron 1520" |
Sleep |
XF86Standby |
223 / sleep |
223 /sleep |
|
sleep |
|
|
sleep |
223 / sleep |
|
223 / sleep |
|
|
165 |
|
223 / sleep |
|
165 / XF86Sleep |
Hibernate |
XF86Sleep |
|
165 / hibernate |
|
|
|
|
165 |
- |
|
|
|
|
Available, works, no keycode |
|
n/a |
|
n/a |
Battery/Power modes |
XF86LaunchB |
241 / battery |
241 |
|
|
241 |
|
241 / battery |
- |
|
|
|
|
241 / XF86LaunchB |
|
n/a |
|
241 / XF86LaunchB |
Info |
XF86Launch0 |
245 / info |
|
|
|
n/a |
|
|
- |
n/a |
245 / help |
|
|
|
|
key exists (Fn+F1) but doesn't return no keycode |
|
n/a |
Presentation |
XF86LaunchC |
205 / presentation |
|
|
|
n/a |
n/a |
|
- |
n/a |
|
|
|
|
|
n/a |
|
n/a |
Mute |
XF86AudioMute |
160 / mute |
160 |
160 |
160 / mute |
160 |
160 |
160 / mute |
160 / mute |
160 |
? / mute |
160 / nosymbol |
160 / Mute On/Off |
160 |
160 |
160 / Mute On/Off |
160 |
160 XF86AudioMute |
Volume Down |
XF86AudioLowerVolume |
174 / volumedown |
|
174 |
174 / volumedown |
174 |
174 |
174 / volumedown |
174 / volumedown |
174 |
? / vol+ |
174 / nosymbol |
174 / volumedown |
174 |
174 |
174 / Volume down |
174 |
174 / XF86AudioLowerVolume |
Volume Up |
XF86AudioRaiseVolume |
176 / volumeup |
|
176 |
176 / volumeup |
176 |
176 |
176 / volumeup |
176 / volumeup |
176 |
? / vol- |
176 / nosymbol |
176 / volume up |
176 |
176 |
176 / Volume up |
176 |
176 / XF86AudioRaiseVolume |
Play Pause |
XF86AudioPause |
|
|
|
|
|
|
162 |
162 / playpause |
|
162 / playrestart |
|
|
162 |
|
n/a |
|
162 / XF86AudioPause |
Next Track |
XF86AudioNext |
|
|
|
|
|
|
153 |
153 / nextsong |
|
153 / nextrack |
|
|
153 |
|
n/a |
|
153 / XF86AudioNext |
Previous Track |
XF86AudioPrev |
|
|
|
|
|
|
144 |
144 / previoussong |
|
144 / prevtrack |
|
|
144 |
|
n/a |
|
144 / XF86AudioPrev |
Stop |
XF86AudioStop |
|
|
|
|
|
|
164 |
164 / stopcd |
|
164 / stop |
|
|
164 |
|
n/a |
|
164 / XF86AudioStop |
Lock screen |
XF86Lock |
|
146 |
|
|
n/a |
|
|
- |
|
146 / doesn't work |
|
|
NA |
|
There is a key (Fn+F4) for shutting down the LCD screen (Windows). Doesn't work, no keycode. |
|
|
Switch Monitor |
|
|
|
|
|
? |
|
170 |
- |
n/a |
no number |
|
works, no keycode |
170 |
works, no keycode |
key exists (Fn+F3) but doesn't work, no keycode. |
|
|
Eject CD/DVD |
XF86Eject |
|
|
|
|
no keycode |
|
204 |
- |
204 |
|
204 / nosymbol |
|
204 |
|
n/a |
204 |
|
Brightness Up |
|
|
|
|
|
212 |
no keycode |
212 |
- |
|
? / bright+ |
212 / nosymbol |
works, no keycode and nosymbol |
212 |
works, no keycode |
239 (really!) / works but no symbol |
212 / nosymbol |
212 |
Brightness Down |
|
|
|
|
|
no keycode |
239 |
101 |
- |
|
? / bright- |
101 / nosymbol |
works, no keycode and nosymbol |
101 |
239 |
works but no keycode |
101 / nosymbol |
101 |
Cut |
|
|
|
|
|
|
|
|
188 / cut |
|
|
|
|
NA |
|
n/a |
|
|
Copy |
|
|
|
|
|
|
|
|
248 / copy |
|
|
|
|
NA |
|
n/a |
|
|
Paste |
|
|
|
|
|
|
|
|
192 / paste |
|
|
|
|
NA |
|
n/a |
|
|
Calculator |
XF86Calculator |
|
|
|
|
|
|
|
161 / calc |
|
|
|
|
NA |
|
n/a |
|
|
Internet (browser) |
XF86HomePage |
|
|
|
|
|
|
|
130 / homepage |
|
178 / doesn't work |
|
doesn't work |
NA |
|
178 / XF86WWW / does nothing |
|
|
XF86Mail |
|
|
|
|
|
|
|
236 / mail |
|
|
|
236 / XF86Mail / launch kmail |
NA |
|
236 / XF86Mail / launch kmail |
|
|
|
Search |
|
|
|
|
|
|
|
|
122 / find |
|
|
|
|
NA |
|
n/a |
|
|
Back |
XF86Back |
|
|
|
|
|
|
|
234 / back |
|
|
|
doesn't work |
NA |
|
n/a |
|
|
Forward |
XF86Forward |
|
|
|
|
|
|
|
233 / forward |
|
|
|
doesn't work |
NA |
|
n/a |
|
|
Favorites/Bookmarks |
XF86Favorites |
|
|
|
|
|
|
|
230 / bookmarks |
|
|
|
|
NA |
|
n/a |
|
|
Note: list of available XF86 keysyms is available in the /usr/share/X11/XKeysymDB file (part of libx11-data package).
How to get keycode?
You can get keycode by running xev program from command line (terminal/Konsole) and then pressing the special laptop keys and searching for keycode, for example output:
KeyPress event, serial 28, synthetic NO, window 0x5000001, root 0x76, subw 0x0, time 1400690129, (70,50), root:(74,102), state 0x0, keycode 223 (keysym 0x1008ff10, XF86Standby), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False KeyRelease event, serial 28, synthetic NO, window 0x5000001, root 0x76, subw 0x0, time 1400690129, (70,50), root:(74,102), state 0x0, keycode 223 (keysym 0x1008ff10, XF86Standby), same_screen YES, XLookupString gives 0 bytes:
An easier way to do this is to run:
xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
This will only output pressed keycode and currently assigned keysym, for example:
160 XF86AudioMute 174 XF86AudioLowerVolume 176 XF86AudioRaiseVolume
How to get HAL events?
You can get HAL events by running lshal -m program from command line (terminal/Konsole) and the pressing special laptop keys which will generate output like this:
Start monitoring devicelist: ------------------------------------------------- platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = sleep platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = battery platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = help platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = presentation platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = mute platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = volumedown platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = volumeup
What if the key does not produce keycode / HAL event?
You should check LaptopTestingTeam/HotkeyResearch page for details how to get this addressed.
Developer's TODO List
Add missing keycode -> xkeysym mappings: XF86HomePage, XF86Lock (what xkeysym to use)?
- Add missing default actions: Lock, Favorites
Diagnose and fix XF86WWW which does not get properly processed
- Try to pre-configure Firefox to work out of the box (similar to Konqueror)
User Comments & Notes
Please add your comments here and add your name.
Notes
Travelmate 8100 Notes: I have a wireless button. To get it to work I had to first edit the hotkeys-setup (/usr/share/hotkeys-setup/acer.hk) and add the lines
setkeycodes e055 $KEY_F13 # Orange Wireless On (hardware, led, informational only) setkeycodes e056 $KEY_F14 # Orange Wireless Off (hardware, led, informational only)
then I could set up the keycodes in X with xmodmap to ifup/ifdown the wlan.
keycode 182 = XF86User1KB keycode 183 = XF86User2KB
Would be nice if these buttons could be used "out of the box". Although perhaps to leave it to the user in kde as to how they manage the actual buttons
Dell Inspiron 6400 Notes:
- [1]:Wifi key behavior is configurable at the BIOS.
- [2]:It takes a while and then it prints:
acpi_BAT0 property battery.voltage.current = 12562 (0x3112)
HP Compaq NX9005 Notes:
- It seems that I can't even check the keycodes of the Search, Lock, Help and Wireless buttons on this laptop - tried: xev, lshal, showkey, check acpi events from log, KDE hotkey assign. Other buttons, like "XF86WWW", XF86Mail, XF86AudioRaiseVolume, XF86AudioLowerVolume work without problems.
- Laptop: Hewlett-Packard HP nx9005 (DJ163A) KAM1.58
Travelmate 3212WXWmi Notes:
- This may apply also to other Travelmates.
The special buttons on the laptop for email and browser do not work, they don't generate events at all (it's a "feature" of the BIOS,see http://www.cakey.de/acerhk/ for more information)
- Brightness up works but doesn't generate an event.
Some keycodes need to be set using setkeycode as they don't generate X events. This script, available at http://members.inode.at/p.pregler/linux/acer-tm3200-keys enables other special keys. It was made for an Acer Travelmate 3200, but it works well on my laptop as well. A complete list of keycodes is available at http://members.inode.at/p.pregler/linux/tm3200-keys-custom.txt
Fujitsu-Siemens Amilo Pro Edition V3505:
- Has a wireless hotkey (that does Wifi + Bluetooth on/off under Windows). Doesn't work out of the box in Feisty Herd 4. Returns no keycode in xev. Returns this in dmesg:
[ 306.976000] atkbd.c: Unknown key released (translated set 2, code 0xd6 on isa0060/serio0). [ 306.976000] atkbd.c: Use 'setkeycodes e056 <keycode>' to make it known.
- Has a wireless on/off key accessible through Fn+F10. Doesn't work in Feisty Herd 4. Returns no keycode in xev. Returns this in dmesg (same as wireless hotkey):
[ 881.612000] atkbd.c: Unknown key pressed (translated set 2, code 0xd6 on isa0060/serio0). [ 881.612000] atkbd.c: Use 'setkeycodes e056 <keycode>' to make it known.
- Info key (Fn+F1): dmesg returns this:
[ 1740.488000] atkbd.c: Unknown key pressed (translated set 2, code 0xa5 on isa0060/serio0). [ 1740.488000] atkbd.c: Use 'setkeycodes e025 <keycode>' to make it known.
- Lock screen key (Fn+F4): dmesg returns nothing.
- Switch monitor key (Fn+F3): dmesg returns this:
[ 1984.336000] atkbd.c: Unknown key pressed (translated set 2, code 0xa9 on isa0060/serio0). [ 1984.336000] atkbd.c: Use 'setkeycodes e029 <keycode>' to make it known.
- Brightness up key (Fn+F9): dmesg returns nothing...
- Brightness down key (Fn+F8): dmesg returns this:
[ 2075.752000] atkbd.c: Unknown key pressed (translated set 2, code 0xd9 on isa0060/serio0). [ 2075.752000] atkbd.c: Use 'setkeycodes e059 <keycode>' to make it known.
Lenovo ThinkPad X61:
See http://www.thinkwiki.org/Installing_Ubuntu_8.10_(Intrepid_Ibex)_on_a_ThinkPad_X61 for a table of keycodes for the Lenovo ThinkPad X61.