1SHOWKEY(1) General Commands Manual SHOWKEY(1)
2
3
4
6 showkey - examine the codes sent by the keyboard
7
9 showkey [-h|--help] [-a|--ascii] [-s|--scancodes] [-k|--keycodes]
10 [-V|--version]
11
13 showkey prints to standard output either the scan codes or the keycode
14 or the `ascii' code of each key pressed. In the first two modes the
15 program runs until 10 seconds have elapsed since the last key press or
16 release event, or until it receives a suitable signal, like SIGTERM,
17 from another process. In `ascii' mode the program terminates when the
18 user types ^D.
19
20 When in scancode dump mode, showkey prints in hexadecimal format each
21 byte received from the keyboard to the standard output. A new line is
22 printed when an interval of about 0.1 seconds occurs between the bytes
23 received, or when the internal receive buffer fills up. This can be
24 used to determine roughly, what byte sequences the keyboard sends at
25 once on a given key press. The scan code dumping mode is primarily
26 intended for debugging the keyboard driver or other low level inter‐
27 faces. As such it shouldn't be of much interest to the regular end-
28 user. However, some modern keyboards have keys or buttons that produce
29 scancodes to which the kernel does not associate a keycode, and, after
30 finding out what these are, the user can assign keycodes with setkey‐
31 codes(8).
32
33 When in the default keycode dump mode, showkey prints to the standard
34 output the keycode number or each key pressed or released. The kind of
35 the event, press or release, is also reported. Keycodes are numbers
36 assigned by the kernel to each individual physical key. Every key has
37 always only one associated keycode number, whether the keyboard sends
38 single or multiple scan codes when pressing it. Using showkey in this
39 mode, you can find out what numbers to use in your personalized keymap
40 files.
41
42 When in `ascii' dump mode, showkey prints to the standard output the
43 decimal, octal, and hexadecimal value(s) of the key pressed, according
44 to he present keymap.
45
47 -h --help
48 showkey prints to the standard error output its version number,
49 a compile option and a short usage message, then exits.
50
51 -s --scancodes
52 Starts showkey in scan code dump mode.
53
54 -k --keycodes
55 Starts showkey in keycode dump mode. This is the default, when
56 no command line options are present.
57
58 -a --ascii
59 Starts showkey in `ascii' dump mode.
60
61 -V --version
62 showkey prints version number and exits.
63
65 In 2.6 kernels key codes lie in the range 1-255, instead of 1-127. Key
66 codes larger than 127 are returned as three bytes of which the low
67 order 7 bits are: zero, bits 13-7, and bits 6-0 of the key code. The
68 high order bits are: 0/1 for make/break, 1, 1.
69
70 In 2.6 kernels raw mode, or scancode mode, is not very raw at all.
71 Scan codes are first translated to key codes, and when scancodes are
72 desired, the key codes are translated back. Various transformations are
73 involved, and there is no guarantee at all that the final result corre‐
74 sponds to what the keyboard hardware did send. So, if you want to know
75 the scan codes sent by various keys it is better to boot a 2.4 kernel.
76 Since 2.6.9 there also is the boot option atkbd.softraw=0 that tells
77 the 2.6 kernel to return the actual scan codes.
78
79
81 The raw scan codes are available only on AT and PS/2 keyboards, and
82 even then they are disabled unless the atkbd.softraw=0 kernel parameter
83 is used. When the raw scan codes are not available, the kernel uses a
84 fixed built-in table to produce scan codes from keycodes. Thus, setk‐
85 eycodes(8) can affect the output of showkey in scan code dump mode.
86
87
89 loadkeys(1), dumpkeys(1), keymaps(5), setkeycodes(8)
90
91
92
93 1 Feb 1998 SHOWKEY(1)