Blame docs/doc/kbd.FAQ-14.html

Packit Service 50ad14
Packit Service 50ad14
<HTML>
Packit Service 50ad14
<HEAD>
Packit Service 50ad14
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
Packit Service 50ad14
 <TITLE>The Linux keyboard and console HOWTO: Unusual keys and keyboards</TITLE>
Packit Service 50ad14
 <LINK HREF="kbd.FAQ-15.html" REL=next>
Packit Service 50ad14
 <LINK HREF="kbd.FAQ-13.html" REL=previous>
Packit Service 50ad14
 <LINK HREF="kbd.FAQ.html#toc14" REL=contents>
Packit Service 50ad14
</HEAD>
Packit Service 50ad14
<BODY>
Packit Service 50ad14
Next
Packit Service 50ad14
Previous
Packit Service 50ad14
Contents
Packit Service 50ad14

Packit Service 50ad14

14. Unusual keys and keyboards

Packit Service 50ad14
Packit Service 50ad14

Packit Service 50ad14
Packit Service 50ad14
keyboard!unusual versions of
Packit Service 50ad14
-->
Packit Service 50ad14
Packit Service 50ad14
Packit Service 50ad14
keyboard!non-standard keys on
Packit Service 50ad14
-->
Packit Service 50ad14

The two keys PrintScrn/SysRq and Pause/Break are special in that they

Packit Service 50ad14
have two keycodes: the former has keycode 84 when Alt is pressed
Packit Service 50ad14
simultaneously, and keycode 99 otherwise; the latter has keycode
Packit Service 50ad14
101 when Ctrl is pressed simultaneously, and keycode 119 otherwise.
Packit Service 50ad14
(Thus, it makes no sense to bind functions to Alt keycode 99 or
Packit Service 50ad14
Ctrl keycode 119.) The Pause/Break key is also special in another way:
Packit Service 50ad14
it does not generate key-up scancodes, but generates the entire
Packit Service 50ad14
6-scancode sequence on key-down.
Packit Service 50ad14

If you have strange keys, that do not generate any code under Linux

Packit Service 50ad14
(or generate messages like "unrecognized scancode"), and your kernel
Packit Service 50ad14
is 1.1.63 or later, then you can use setkeycodes(1) to tell the kernel
Packit Service 50ad14
about them. Once they have gotten a keycode from setkeycodes,
Packit Service 50ad14
they can be assigned a function by loadkeys.
Packit Service 50ad14

For example, using showkey -s one sees that Microsoft keyboards

Packit Service 50ad14
use the scancode sequences (in hexadecimal) e0 5b (left Windows key),
Packit Service 50ad14
e0 5c (right Windows key), e0 5d (Menu key).
Packit Service 50ad14
Microsoft Internet keyboard also uses e0 6a (Back), e0 69 (Forward),
Packit Service 50ad14
e0 68 (Stop), e0 6c (Mail), e0 65 (Search), e0 66 (Favorites),
Packit Service 50ad14
e0 32 (Web/Home), e0 6b (My Computer), e0 21 (Calculator), e0 5f (Sleep).
Packit Service 50ad14
Use dumpkeys to see what keycodes are still unused.
Packit Service 50ad14
Typically values like 89-95 and 112-118 and 120-127 are free.
Packit Service 50ad14
Now
Packit Service 50ad14
Packit Service 50ad14
Packit Service 50ad14
        % setkeycodes e05b 125
Packit Service 50ad14
        % setkeycodes e05c 126
Packit Service 50ad14
        % setkeycodes e05d 127
Packit Service 50ad14
Packit Service 50ad14
Packit Service 50ad14
Packit Service 50ad14
assigns keycodes to these scancode sequences, and
Packit Service 50ad14
Packit Service 50ad14
Packit Service 50ad14
        % loadkeys
Packit Service 50ad14
        keycode 125 = Decr_Console
Packit Service 50ad14
        keycode 126 = Incr_Console
Packit Service 50ad14
        keycode 127 = KeyboardSignal
Packit Service 50ad14
        %
Packit Service 50ad14
Packit Service 50ad14
Packit Service 50ad14
Packit Service 50ad14
would make these Windows keys go to the previous or next virtual console,
Packit Service 50ad14
and let the Menu key create a fresh virtual console (in case you have
Packit Service 50ad14
something like spawn_console running).
Packit Service 50ad14

Packit Service 50ad14

14.1 Funkeys

Packit Service 50ad14
Packit Service 50ad14
Packit Service 50ad14

Many modern keyboards have buttons or keys with labels like

Packit Service 50ad14
"Vol Up", "Eject" etc. that suggest actions rather than strings.
Packit Service 50ad14
Of course one can bind shell commands to them, but then they'll
Packit Service 50ad14
work only when you are at a shell prompt.
Packit Service 50ad14
Rick van Rein wrote a package funkey consisting of a kernel patch
Packit Service 50ad14
and a daemon. The kernel patch creates a new character device,
Packit Service 50ad14
and adds a new key type to indicate which keystrokes should be
Packit Service 50ad14
sent to this new character device. A daemon can now listen to
Packit Service 50ad14
the character device, somewhat like gpm listens to the
Packit Service 50ad14
mouse device, and perform the actions indicated in its config file.
Packit Service 50ad14
See 
Packit Service 50ad14
rick.vanrein.org/linux/funkey.
Packit Service 50ad14

Packit Service 50ad14

Packit Service 50ad14
Next
Packit Service 50ad14
Previous
Packit Service 50ad14
Contents
Packit Service 50ad14
</BODY>
Packit Service 50ad14
</HTML>