chiark / gitweb /
detect-virt: detect User-Mode Linux
[elogind.git] / src / udev / keymap / README.keymap.txt
1 = The udev keymap tool =
2
3 == Introduction ==
4
5 This udev extension configures computer model specific key mappings. This is
6 particularly necessary for the non-standard extra keys found on many laptops,
7 such as "brightness up", "next song", "www browser", or "suspend". Often these
8 are accessed with the Fn key.
9
10 Every key produces a "scan code", which is highly vendor/model specific for the
11 nonstandard keys. This tool maintains mappings for these scan codes to standard
12 "key codes", which denote the "meaning" of the key. The key codes are defined
13 in /usr/include/linux/input.h.
14
15 If some of your keys on your keyboard are not working at all, or produce the
16 wrong effect, then a very likely cause of this is that the scan code -> key
17 code mapping is incorrect on your computer.
18
19 == Structure ==
20
21 udev-keymap consists of the following parts:
22
23  keymaps/*:: mappings of scan codes to key code names
24
25  95-keymap.rules:: udev rules for mapping system vendor/product names and
26  input module names to one of the keymaps above
27
28  keymap:: manipulate an evdev input device:
29   * write a key map file into a device (used by udev rules)
30   * dump current scan → key code mapping
31   * interactively display scan and key codes of pressed keys
32
33  findkeyboards:: display evdev input devices which belong to actual keyboards,
34  i. e. those suitable for the keymap program
35
36 == Fixing broken keys ==
37
38 In order to make a broken key work on your system and send it back to upstream
39 for inclusion you need to do the following steps:
40
41  1. Find the keyboard device.
42
43  Run /usr/lib/udev/findkeyboards. This should always give you an "AT
44  keyboard" and possibly a "module". Some laptops (notably Thinkpads, Sonys, and
45  Acers) have multimedia/function keys on a separate input device instead of the
46  primary keyboard. The keyboard device should have a name like "input/event3".
47  In the following commands, the name will be written as "input/eventX" (replace
48  X with the appropriate number).
49
50  2. Find broken scan codes:
51
52  sudo /usr/lib/udev/keymap -i input/eventX
53
54  Press all multimedia/function keys and check if the key name that gets printed
55  out is plausible. If it is unknown or wrong, write down the scan code (looks
56  like "0x1E") and the intended functionality of this key. Look in
57  /usr/include/linux/input.h for an available KEY_XXXXX constant which most
58  closely approximates this functionality and write it down as the new key code.
59
60  For example, you might press a key labeled "web browser" which currently
61  produces "unknown". Note down this:
62
63    0x1E www # Fn+F2 web browser
64
65  Repeat that for all other keys. Write the resulting list into a file. Look at
66  /usr/lib/udev/keymaps/ for existing key map files and make sure that you use the
67  same structure.
68
69  If the key only ever works once and then your keyboard (or the entire desktop)
70  gets stuck for a long time, then it is likely that the BIOS fails to send a
71  corresponding "key release" event after the key press event. Please note down
72  this case as well, as it can be worked around in
73  /usr/lib/udev/keymaps/95-keyboard-force-release.rules .
74
75  3. Find out your system vendor and product:
76
77  cat /sys/class/dmi/id/sys_vendor
78  cat /sys/class/dmi/id/product_name
79
80  4. Generate a device dump with "udevadm info --export-db > /tmp/udev-db.txt".
81
82  6. Send the system vendor/product names, the key mapping from step 2,
83  and /tmp/udev-db.txt from step 4 to the linux-hotplug@vger.kernel.org mailing
84  list, so that they can be included in the next release.
85
86 For local testing, copy your map file to /usr/lib/udev/keymaps/ with an appropriate
87 name, and add an appropriate udev rule to /usr/lib/udev/rules.d/95-keymap.rules:
88
89   * If you selected an "AT keyboard", add the rule to the section after
90   'LABEL="keyboard_vendorcheck"'.
91
92   * If you selected a "module", add the rule to the top section where the
93   "ThinkPad Extra Buttons" are.
94
95 == Author ==
96
97 keymap is written and maintained by Martin Pitt <martin.pitt@ubuntu.com>.