9 .Nd pc keyboard interface
12 The PC keyboard is used as the console character input device.
14 is owned by the current virtual console.
15 To switch between the virtual consoles use the sequence
17 which means hold down ALT and press one of the function keys.
19 virtual console with the same number as the function key is then
20 selected as the current virtual console and given exclusive use of
21 the keyboard and display.
23 The console allows entering values that are not physically
24 present on the keyboard via a special keysequence.
25 To use this facility press and hold down ALT,
26 then enter a decimal number from 0-255 via the numerical keypad, then
28 The entered value is then used as the ASCII value for one
30 This way it is possible to enter any ASCII value, not present
32 The console driver also includes a history function.
34 pressing the scroll-lock key.
35 This holds the display, and enables the cursor
36 arrows for scrolling up and down through the last scrolled out lines.
38 The keyboard is configurable to suit the individual user and the different
41 The keys on the keyboard can have any of the following functions:
43 Normal key - Enter the ASCII value associated with the key.
45 Function key - Enter a string of ASCII values.
47 Switch Key - Switch virtual console.
49 Modifier Key - Change the meaning of another key.
52 The keyboard is seen as a number of keys numbered from 1 to n. This
53 number is often referred to as the "scancode" for a given key.
55 of the key is transmitted as an 8 bit char with bit 7 as 0 when a key is
56 pressed, and the number with bit 7 as 1 when released.
58 possible to make the mapping of the keys fully configurable.
60 The meaning of every key is programmable via the PIO_KEYMAP ioctl call, that
61 takes a structure keymap_t as argument.
62 The layout of this structure is as
65 .Bd -literal -offset indent
69 u_char map[NUM_STATES];
76 The field n_keys tells the system how many keydefinitions (scancodes)
78 Each scancode is then specified in the key_t substructure.
80 Each scancode can be translated to any of 8 different values, depending
81 on the shift, control, and alt state.
82 These eight possibilities are
83 represented by the map array, as shown below:
86 scan cntrl alt alt cntrl
87 code base shift cntrl shift alt shift cntrl shift
88 map[n] 0 1 2 3 4 5 6 7
89 ---- ------------------------------------------------------
90 0x1E 'a' 'A' 0x01 0x01 'a' 'A' 0x01 0x01
92 This is the default mapping for the key labelled 'A' which normally has
93 scancode 0x1E. The eight states are as shown, giving the 'A' key its
95 The spcl field is used to give the key "special" treatment, and is
96 interpreted as follows.
97 Each bit corresponds to one of the states above.
99 key emits the number defined in the corresponding map[] entry.
100 If the bit is 1 the key is "special". This means it does not emit
101 anything; instead it changes the "state". That means it is a shift,
102 control, alt, lock, switch-screen, function-key or no-op key.
103 The bitmap is backwards ie. 7 for base, 6 for shift etc.
105 The flgs field defines if the key should react on caps-lock (1),
106 num-lock (2), both (3) or ignore both (0).
110 utility is used to load such a description into/outof
111 the kernel at runtime.
112 This makes it possible to change the key
113 assignments at runtime, or more important to get (GIO_KEYMAP ioctl)
114 the exact key meanings from the kernel (fx. used by the X server).
116 The function keys can be programmed using the SETFKEY ioctl call.
118 This ioctl takes a argument of the type fkeyarg_t:
119 .Bd -literal -offset indent
127 The field keynum defines which function key that is programmed.
128 The array keydef should contain the new string to be used (MAXFK long),
129 and the length should be entered in flen.
131 The GETFKEY ioctl call works in a similar manner, except it returns
132 the current setting of keynum.
134 The function keys are numbered like this:
135 .Bd -literal -offset indent
137 Shift F1-F12 key 13 - 24
138 Ctrl F1-F12 key 25 - 36
139 Ctrl+shift F1-F12 key 37 - 48
162 utility also allows changing these values at runtime.
165 .An Søren Schmidt Aq sos@FreeBSD.org