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