1SHOWKEY(1)                  General Commands Manual                 SHOWKEY(1)
2
3
4

NAME

6       showkey - examine the codes sent by the keyboard
7

SYNOPSIS

9       showkey [-h|--help] [-a|--ascii] [-s|--scancodes] [-k|--keycodes]
10

DESCRIPTION

12       showkey  prints to standard output either the scan codes or the keycode
13       or the `ascii' code of each key pressed.  In the first  two  modes  the
14       program  runs until 10 seconds have elapsed since the last key press or
15       release event, or until it receives a suitable  signal,  like  SIGTERM,
16       from  another process.  In `ascii' mode the program terminates when the
17       user types ^D.
18
19       When in scancode dump mode, showkey prints in hexadecimal  format  each
20       byte  received  from the keyboard to the standard output. A new line is
21       printed when an interval of about 0.1 seconds occurs between the  bytes
22       received,  or  when  the  internal receive buffer fills up. This can be
23       used to determine roughly, what byte sequences the  keyboard  sends  at
24       once  on  a  given  key  press. The scan code dumping mode is primarily
25       intended for debugging the keyboard driver or other  low  level  inter‐
26       faces.  As  such  it  shouldn't be of much interest to the regular end-
27       user. However, some modern keyboards have keys or buttons that  produce
28       scancodes  to which the kernel does not associate a keycode, and, after
29       finding out what these are, the user can assign keycodes  with  setkey‐
30       codes(8).
31
32       When  in  the default keycode dump mode, showkey prints to the standard
33       output the keycode number or each key pressed or released. The kind  of
34       the  event,  press  or release, is also reported.  Keycodes are numbers
35       assigned by the kernel to each individual physical key. Every  key  has
36       always  only  one associated keycode number, whether the keyboard sends
37       single or multiple scan codes when pressing it. Using showkey  in  this
38       mode,  you can find out what numbers to use in your personalized keymap
39       files.
40
41       When in `ascii' dump mode, showkey prints to the  standard  output  the
42       decimal,  octal, and hexadecimal value(s) of the key pressed, according
43       to he present keymap.
44

OPTIONS

46       -h --help
47              showkey prints to the standard error output its version  number,
48              a compile option and a short usage message, then exits.
49
50       -s --scancodes
51              Starts showkey in scan code dump mode.
52
53       -k --keycodes
54              Starts  showkey  in keycode dump mode. This is the default, when
55              no command line options are present.
56
57       -a --ascii
58              Starts showkey in `ascii' dump mode.
59

2.6 KERNELS

61       In 2.6 kernels key codes lie in the range 1-255, instead of 1-127.  Key
62       codes  larger  than  127  are  returned as three bytes of which the low
63       order 7 bits are: zero, bits 13-7, and bits 6-0 of the key  code.   The
64       high order bits are: 0/1 for make/break, 1, 1.
65
66       In  2.6  kernels  raw  mode,  or scancode mode, is not very raw at all.
67       Scan codes are first translated to key codes, and  when  scancodes  are
68       desired, the key codes are translated back. Various transformations are
69       involved, and there is no guarantee at all that the final result corre‐
70       sponds  to what the keyboard hardware did send. So, if you want to know
71       the scan codes sent by various keys it is better to boot a 2.4  kernel.
72       Since  2.6.9  there  also is the boot option atkbd.softraw=0 that tells
73       the 2.6 kernel to return the actual scan codes.
74
75

NOTES

77       The raw scan codes are available only on AT  and  PS/2  keyboards,  and
78       even then they are disabled unless the atkbd.softraw=0 kernel parameter
79       is used.  When the raw scan codes are not available, the kernel uses  a
80       fixed  built-in table to produce scan codes from keycodes.  Thus, setk‐
81       eycodes(8) can affect the output of showkey in scan code dump mode.
82
83

SEE ALSO

85       loadkeys(1), dumpkeys(1), keymaps(5), setkeycodes(8)
86
87
88
89                                  1 Feb 1998                        SHOWKEY(1)
Impressum