| 1 |
.\" @(#)man/man8/setkeycodes.8 1.0 Nov 8 22:30:48 MET 1994 |
| 2 |
.TH SETKEYCODES 8 "24 October 2024" "kbd" |
| 3 |
.SH NAME |
| 4 |
setkeycodes \- load kernel scancode-to-keycode mapping table entries |
| 5 |
.SH SYNOPSIS |
| 6 |
.B setkeycodes |
| 7 |
[\fI\,options\/\fR] |
| 8 |
.I "scancode keycode ..." |
| 9 |
.SH DESCRIPTION |
| 10 |
The |
| 11 |
.I setkeycodes |
| 12 |
command reads its arguments two at a time, each pair of arguments |
| 13 |
consisting of a scancode (given in hexadecimal) and a keycode (given |
| 14 |
in decimal). For each such pair, it tells the kernel keyboard driver |
| 15 |
to map the specified scancode to the specified keycode. |
| 16 |
|
| 17 |
This command is useful only for people with slightly unusual keyboards, |
| 18 |
that have a few keys which produce scancodes that the kernel does not |
| 19 |
recognize. |
| 20 |
|
| 21 |
.SH THEORY |
| 22 |
The usual PC keyboard produces a series of scancodes for each |
| 23 |
key press and key release. (Scancodes are shown by |
| 24 |
\fBshowkey \-s\fP, see |
| 25 |
.BR showkey (1) |
| 26 |
) The kernel parses this stream of scancodes, and converts it to |
| 27 |
a stream of keycodes (key press/release events). |
| 28 |
(Keycodes are shown by \fBshowkey\fP.) |
| 29 |
Apart from a few scancodes with special meaning, and apart from |
| 30 |
the sequence produced by the Pause key, and apart from shiftstate |
| 31 |
related scancodes, and apart from the key up/down bit, |
| 32 |
the stream of scancodes consists of unescaped |
| 33 |
scancodes xx (7 bits) and escaped scancodes e0 xx (8+7 bits). |
| 34 |
To these scancodes or scancode pairs, a corresponding keycode can be |
| 35 |
assigned (in the range 1-127). |
| 36 |
For example, if you have a Macro key that produces e0 6f according |
| 37 |
to |
| 38 |
.BR showkey (1), |
| 39 |
the command |
| 40 |
.RS |
| 41 |
.B "setkeycodes e06f 112" |
| 42 |
.RE |
| 43 |
will assign the keycode 112 to it, and then |
| 44 |
.BR loadkeys (1) |
| 45 |
can be used to define the function of this key. |
| 46 |
.LP |
| 47 |
Some older kernels might hardwire a low scancode range to the |
| 48 |
equivalent keycodes; setkeycodes will fail when you try to remap |
| 49 |
these. |
| 50 |
|
| 51 |
.SH "2.6 KERNELS" |
| 52 |
In 2.6 kernels key codes lie in the range 1-255, instead of 1-127. |
| 53 |
(It might be best to confine oneself to the range 1-239.) |
| 54 |
.LP |
| 55 |
In 2.6 kernels raw mode, or scancode mode, is not very raw at all. |
| 56 |
The code returned by showkey \-s will change after use of setkeycodes. |
| 57 |
A kernel bug. See also |
| 58 |
.BR showkey (1). |
| 59 |
.SH OPTIONS |
| 60 |
.TP |
| 61 |
\fB\-C\fR, \fB\-\-console\fR=\fI\,DEV\/\fR |
| 62 |
the console device to be used. |
| 63 |
.TP |
| 64 |
\fB\-V\fR, \fB\-\-version\fR |
| 65 |
print version number. |
| 66 |
.TP |
| 67 |
\fB\-h\fR, \fB\-\-help\fR |
| 68 |
print this usage message. |
| 69 |
.SH BUGS |
| 70 |
The keycodes of X have nothing to do with those of Linux. |
| 71 |
Unusual keys can be made visible under Linux, but not under X. |
| 72 |
.SH "SEE ALSO" |
| 73 |
.BR dumpkeys (1), |
| 74 |
.BR loadkeys (1), |
| 75 |
.BR showkey (1), |
| 76 |
.BR getkeycodes (8) |