Keycodes

This page should be used to collect keyboard data from various laptop keyboards. The priority goes to laptop keyboards from the following manufacturers: IBM, Toshiba, Dell, and HP/Compaq.

Keyboard configuration for Linux and X11 is over-complicated, so collecting keyboard data may need to be done in three places: X11, the Linux kernel, and the BIOS.

Gathering X keycodes

In order to get the X keycode for a key, open up a terminal and run xev. Put the cursor in the window that appears, and press the key. The terminal should output information like this:

KeyRelease event, serial 28, synthetic NO, window 0x2800001,
    root 0x46, subw 0x0, time 2178948, (142,22), root:(148,117),
    state 0x0, keycode 164 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:

If no information is displayed, it might be an X11 bug, a mis-configuration in the Linux kernel, or BIOS problem.

Gathering Linux keycodes and scancodes

If xev doesn't output anything when the key is pressed, check that the Linux kernel is getting the keycodes.

To check the kernel keycodes, you will need to switch to the console. To switch back to X, you will press <Alt> and <F7> at the same time. To switch to the first Linux console, press <Ctrl>, <Alt> and <F1> at the same time. Now run showkey and press the key you want to get info about. showkey will exit after no key has been pressed for a couple of seconds. If you get a result here, there is probably a bug in the X11 keycode conversion. If you do not, there may be a kernel configuration problem.

To check if the kernel is ignoring this key, check the kernel log. The easiest way to do this is from an X terminal. Run tail -f /var/log/kern.log and press the key. You may see information like this:

May 21 11:18:59 localhost kernel: atkbd.c: Unknown key pressed (translated set 2, code 0x93 on isa0060/serio0).
May 21 11:18:59 localhost kernel: atkbd.c: Use 'setkeycodes e013 <keycode>' to make it known.
May 21 11:18:59 localhost kernel: atkbd.c: Unknown key released (translated set 2, code 0x93 on isa0060/serio0).
May 21 11:18:59 localhost kernel: atkbd.c: Use 'setkeycodes e013 <keycode>' to make it known.

This means that the console keymap is not configured to recognize this key. If you don't see anything, it could be because:

  • The key only generates an ACPI event.
  • The BIOS won't let the key emit any information until a "knock sequence" is intiated.

Modern BIOSes and keyboards

Some modern laptop BIOSes requires a "knock sequence" to allow the special keys to start generating any keycodes. HP Omnibooks and some Toshiba laptops require this. See the omke, FreeZeeButtons, and fnfx projects.

If a key is pressed, but no information is displayed in /var/log/kern.log, showkey, or xev, your laptop probably requires a "knock sequence."

If some of your keys only generate an ACPI event, then one possibility is to use acpi-keys. This small utility, if integrated with acpid, can generate X events.

Common laptop keys

Laptop keys

Key

Full functionality

"Rad" functionality

Possible X keysym name (from XF86keysym.h or keysymdef.h)

Music/CD/MP3

Launch music player

If the music player isn't running, start it. If it is started and it isn't the top window (minimized or hiding), bring it to the front. If it is the front window, minimize it.

Mail

Launch mail application

Similar to Music key

Info

Launch web browser

Similar ot Music key

Play/Pause

Stop or restart music

XF86AudioPlay or XF86AudioPause

Stop

Stop music

XF86AudioStop or XF86Eject

Next track

Skip to the next track

XF86AudioNext

Previous track

Skip to the previous track

XF86AudioPrev

Mute

Mute or unmute audio

XF86AudioMute

Screen lock

Lock screen

Should blank screen, then (if password set) go to lock screen with Ubuntu countdown on mouse or keyboard activity. Othewise, unblank screen.

Power profile selector

Change CPU power consumption

Should select power consumption profile. (A suggested list is Full Power, High Power, Normal, DVD Playback, Presentation, and Long Life.)

Standby mode (suspend to RAM)

Suspend to RAM

Hibernate mode (suspend to disk)

Suspend to disk

Display modes

Cycle the display modes. (A suggested list of combinations: built-in only, built-in and VGA-out, VGA-out only, built-in and TV-out, TV-out only.)

Brightness down

Reduce the brightness of the built-in display.

Brightness up

Increase the brightness of the built-in display.

Wireless antenna toggle

Enable or disable the wireless antenna.

Trackpad toggle key

Enable or disable the trackpad.

Cursor overlay toggle key

Enable or disable the Cursor overlay (enabling the use of the main keyboard for KP_Left).

Numeric overlay toggle

Enable or disable the Numeric overlay (enabling the use of the main keyboard for KP_4).

Scroll lock

Enable or disable Scroll Lock.

Specific laptop model info

Gericom Blockbuster

Key

Known X keycodes

kern.log output

Mail

236

Info

178

Music/CD/MP3 (hardware music player requires special FAT32 partition

237

Loop

160

Play/Pause

162

Stop

164

Next track

153

Previous track

144

Known owners: ZygmuntKrynicki, VedranMiletic


Asus m6800N

Key

Known X keycodes

/var/log/acpid ouput

Numlock

77

Scrollock

78

Mail

completed event "hotkey ATKD 00000050 00000000"

Web

completed event "hotkey ATKD 00000051 00000000"

Mail

completed event "hotkey ATKD 0000005d 00000002"

Touchpad

completed event "hotkey ATKD 0000006a 00000002"

Power profile selector

completed event "hotkey ATKD 0000005c 00000002"

Play/Pause

completed event "hotkey ATKD 00000045 00000001"

Stop

completed event "hotkey ATKD 00000043 00000001"

Next track

completed event "hotkey ATKD 00000041 00000003"

Previous track

completed event "hotkey ATKD 00000040 00000003"

Known owners: Alex Thomsen Leth megetspam@stofanet.dk


Toshiba Satellite M35X-S149 keys

Key

Known X keycodes

kern.log output

Music/CD/MP3

none

atkbd.c: code 0x93. Use 'setkeycodes e013 <keycode>'

Play/Pause

162

Stop

164

Next track

153

Previous track

144

Mute (<Fn> + <Esc>)

160

Screen lock (<Fn> + <F1>)

none

atkbd.c: code 0xee. Use 'setkeycodes e06e <keycode>'

Power profile selector (<Fn> + <F2>)

none

none

Standby mode (suspend to RAM) (<Fn> + <F3>)

none

none

Hibernate mode (suspend to disk) (<Fn> + <F4>)

none

none

Display modes (<Fn> + <F5>)

none (works once then requires a reboot)

none

Brightness down (<Fn> + <F6>)

239 (and dims LCD)

Brightness up (<Fn> + <F7>)

none (works without generating keycodes)

atkbd.c: code 0xd9. Use 'setkeycodes e059 <keycode>'

Wireless antenna toggle (<Fn> + <F8>)

none (may work; untested)

none

TouchPad toggle key (<Fn> + <F9>)

none (disables TouchPad)

off: kern.log: atkbd.c: code 0x9f. Use 'setkeycodes e01f <keycode>'

on: kern.log: atkbd.c: code 0x9e. Use 'setkeycodes e01e <keycode>'

Cursor overlay toggle key (<Fn> + <F10>)

none (works without generating keycodes)

none

Numeric overlay toggle (<Fn> + <F11>)

77 (Num_Lock, but seems to only work once.)

Scroll lock (<Fn> + <F11>)

78 (Scroll_Lock)

Known owners: FrankMurphy

Requires FreeZeeButton to activate keys. (It has a Phoenix BIOS, instead of a Toshiba BIOS, so fnfx won't work.) omke might also work.


Acer Aspire 1684WLMi keys

Key

Known X keycodes

kern.log output

Play/Pause

162

Stop

164

Next track

153

Previous track

144

Volume up

176

Volume down

174

Hot key help (<Fn> + <F1>

none

Use 'setkeycodes e025 <keycode>' to make it known.

Acer eSetting (<Fn> + <F2>)

none

none

Acer ePowerManagement (<Fn> + <F3>)

none

Use 'setkeycodes e027 <keycode>' to make it known.

Sleep (Zzzz) (<Fn> + <F4>)

none

none

Display modes (<Fn> + <F5>) (untested)

none

Use 'setkeycodes e029 <keycode>' to make it known.

Display on/off toggle (<Fn> + <F6>)

none, but works fine

none

Touchpad toggle (<Fn> + <F7>)

none, but works

Use 'setkeycodes e072 <keycode>' to make it known. when turning touchpad off

Use 'setkeycodes e071 <keycode>' to make it known. when turning it on

Mute (<Fn> + <F8>)

160

Wireless antenna toggle (front of laptop)

none, but works ()

Use 'setkeycodes e056 <keycode>' to make it known.

Bluetooth toggle (untested, module not installed, next to wireless button)

none

Use 'setkeycodes e058 <keycode>' to make it known.

Euro sign key

none

Use 'setkeycodes e033 <keycode>' to make it known.

Dollar sign key

none

Use 'setkeycodes e034 <keycode>' to make it known.

Brightness down (<Fn> + <Arrow left>)

239, dims LCD)

Brightness up (<Fn> + <Arrow right>)

none, brightens LCD

Use 'setkeycodes e06e <keycode>' to make it known.

Email key

236

Web browser key

178

"Acer E-Manager" (user-programmable) (name from manual)

none

Use 'setkeycodes e074 <keycode>' to make it known.

"P" (user-programmable) (name from manual)

none

Use 'setkeycodes e073 <keycode>' to make it known.

Known Owner: Martijn van de Streek

Above values are the same for the Acer Extensa 1522wmli. Known owner: Koert van der Veer


Acer Aspire 1350 keys

Key

Known X keycodes

Lower volume

174

Raise volume

176

Audio mute

160

P1

243

P2

244

WWW

178

E-Mail

236

Known Owner: Marvin Raaijmakers

Notes: The "known X keycodes" listed above are detected on a 2.4 kernel. Some keys of these keys might not have a keycode in kernel 2.6. This keyboard is also supported by keyTouch: http://keytouch.sf.net


HP/Compaq tc1100 tablet keys

Key

Purpose

Known X keycodes

kern.log output

External monitor

Enable/disable external monitor

none

Use 'setkeycodes e002 <keycode>' to make it known.

Q menu

Pop up a menu (helpful in tablet mode)

none

Use 'setkeycodes e003 <keycode>' to make it known.

tab

Tab key; map with setkeycodes e004 15

none

Use 'setkeycodes e004 <keycode>' to make it known.

ESC

ESC key; map with setkeycodes e005 1

none

Use 'setkeycodes e005 <keycode>' to make it known.

Jog up/left

General purpose; useful as PGUP or scroll wheel up

none

Use 'setkeycodes e006 <keycode>' to make it known.

Jog down/right

General purpose; useful as PGDN or scroll wheel down

none

Use 'setkeycodes e007 <keycode>' to make it known.

CategoryLaptop

LaptopTesting/Keycodes (last edited 2008-08-06 16:23:32 by localhost)