minix/man/man5/keymap.5
David van Moolenbroek 6b3f4dc157 Input infrastructure, INPUT server, PCKBD driver
This commit separates the low-level keyboard driver from TTY, putting
it in a separate driver (PCKBD). The commit also separates management
of raw input devices from TTY, and puts it in a separate server
(INPUT). All keyboard and mouse input from hardware is sent by drivers
to the INPUT server, which either sends it to a process that has
opened a raw input device, or otherwise forwards it to TTY for
standard processing.

Design by Dirk Vogt. Prototype by Uli Kastlunger.

Additional changes made to the prototype:

- the event communication is now based on USB HID codes; all input
  drivers have to use USB codes to describe events;
- all TTY keymaps have been converted to USB format, with the effect
  that a single keymap covers all keys; there is no (static) escaped
  keymap anymore;
- further keymap tweaks now allow remapping of literally all keys;
- input device renumbering and protocol rewrite;
- INPUT server rewrite, with added support for cancel and select;
- PCKBD reimplementation, including PC/AT-to-USB translation;
- support for manipulating keyboard LEDs has been added;
- keyboard and mouse multiplexer devices have been added to INPUT,
  primarily so that an X server need only open two devices;
- a new "libinputdriver" library abstracts away protocol details from
  input drivers, and should be used by all future input drivers;
- both INPUT and PCKBD can be restarted;
- TTY is now scheduled by KERNEL, so that it won't be punished for
  running a lot; without this, simply running "yes" on the console
  kills the system;
- the KIOCBELL IOCTL has been moved to /dev/console;
- support for the SCANCODES termios setting has been removed;
- obsolete keymap compression has been removed;
- the obsolete Olivetti M24 keymap has been removed.

Change-Id: I3a672fb8c4fd566734e4b46d3994b4b7fc96d578
2014-03-01 09:04:55 +01:00

183 lines
4.2 KiB
Groff

.TH KEYMAP 5
.SH NAME
keymap \- keyboard maps
.SH SYNOPSIS
.B /etc/keymap
.SH DESCRIPTION
.B /etc/keymap
is the compressed mapping from keyboard scan codes to ASCII.
It is made from a keymap source file consisting of MAP_COLS columns
(MINIX assigns the value 6 to MAX_COLS, corresponding to key pressed,
key+SHIFT, key+LEFT_ALT, key+RIGHT_ALT, key+ALT+SHIFT and key+CTRL) and
NR_SCAN_CODES rows (MINIX assigns the value 0xE8 to NR_SCAN_CODES,
corresponding to the range of defined USB HID key codes, which is the
set of key codes that is to be provided by all keyboard drivers),
and each element is 2 bytes in length (see u16_t in type definitions).
The low order byte corresponds to the character represented by the scan
code, and the high order byte corresponds to the special meaning (when
CAPS LOCK has effect, if it is a function key, etc.), which is converted to
binary keymap format using the
.BR genmap
utility.
.PP
.SS "Types (general): <sys/types.h>"
<sys/types.h> defines the
.B u8_t
and
.B u16_t
types, corresponding to 8 and 16 bit values.
.SS "Keys: <minix/input.h>"
This header file contains the list of keys, prefixed by a
.B INPUT_KEY_
prefix. The
.B K
macro (see below) automatically adds the
.B INPUT_KEY_
prefix to the given key name. Input types from pages other than the key page
are not supported by TTY.
.SS "Macros: <minix/keymap.h>"
.TP
.BI "K(" k ") - Key"
Maps to the entry for the key in the bitmap
.TP
.BI "C(" c ") - Control"
Maps to control code
.TP
.BI "A(" c ") - Alt"
Sets the eight bit
.TP
.BI "CA(" c ") - Control-Alt"
Short for
.BI "A(C(" c "))"
.TP
.BI "L(" c ") - Caps Lock"
Adds Caps Lock effect
.PP
These macros are used in a keymap source file to help define keys. So
instead of writing
.B 032
to put a CTRL-Z in the map you write
.BR "C('Z')" .
The
.BI "L(" c ")"
macro is used in column 0 to tell that the Caps Lock key is active for this
key. (Caps Lock should only have effect on letters.)
Similarly, some keys in column 0 have a
.B N
prefix to indicate that they are affected by the Num Lock key.
.SS "Definitions: <minix/keymap.h>"
<minix/keymap.h> contains a large number of definitions for special keys,
like function keys, and keys on the numeric keypad. They are:
.PP
Modifier keys:
.BR LCTRL ,
.BR RCTRL ,
.BR LSHIFT ,
.BR RSHIFT ,
.BR LALT ,
.BR RALT .
.PP
Special keys:
.BR HOME ,
.BR END ,
.BR UP ,
.BR DOWN ,
.BR LEFT ,
.BR RIGHT ,
.BR PGUP ,
.BR PGDN ,
.BR MID " (numeric '5'),"
.BR MIN " (only with " A " or " C " prefix),"
.BR PLUS ,
.BR INSRT ,
.BR DEL .
.PP
Special keys affected by Num Lock:
.BR NHOME ,
.BR NEND ", ..."
.BR NINSRT ,
.BR NDEL .
.PP
ALT + numpad key:
.BR AHOME ,
.BR AEND ", ...,"
.BR AINSRT .
.PP
CTRL + numpad:
.BR CHOME ,
.BR CEND ", ...,"
.BR CINSRT .
.PP
Lock keys:
.BR CALOCK " (Caps Lock),"
.BR NLOCK " (Num Lock),"
.BR SLOCK " (Scroll Lock)."
.PP
Function keys:
.BR F1 ", ...,"
.BR F12 .
.PP
ALT - function key:
.BR AF1 ", ...,"
.BR AF12 .
.PP
CTRL - function key:
.BR CF1 ", ...,"
.BR CF12 .
.PP
SHIFT - function key:
.BR SF1 ", ...,"
.BR SF12 .
.PP
ALT - SHIFT - function key:
.BR ASF1 ", ...,"
.BR ASF12 .
.PP
.SS "Creating/changing keyboard mapping"
You can create your own keyboard mapping by copying one of the existing
keymap source files (Standard Minix:
.BR drivers/tty/keymaps/*.src )
and modifying the desired keys. Once this has been done, you need to
recompile the genmap.c file, either by adding a new entry to the Makefile,
or by running the following commands:
.PP
.RS
.ft B
cc -DKEYSRC=\e"\fIkeymap\fP.src\e" genmap.c
.ft P
.RE
.PP
After this, the
.BR keymap
file can be generated by running:
.PP
.RS
.BI "a.out > " keymap .map
.RE
.PP
The keymap can be loaded in the keyboard driver by:
.PP
.RS
.BI "loadkeys " keymap .map
.RE
.PP
It is wise to first run
.B loadkeys
on one of the maps in
.B /usr/lib/keymaps
so that you can easily revert back to a known keymap with a few taps on the
up-arrow key and pressing return. You will otherwise have to fix the keymap
with a faulty keymap loaded into the keyboard driver, which is no fun.
.PP
When the keymap is to your satisfaction you can copy it to
.B /etc/keymap
to have it loaded automatically at reboot.
.SH FILES
.TP 15
.B /etc/keymap
Default keymap file
.SH "SEE ALSO"
.B loadkeys (1).
.SH AUTHOR
Victor A. Rodriguez - El bit Fantasma (Bit-Man@Tasa.Com.AR)