9 .Nd pc keyboard interface
11 The PC keyboard is used as the console character input device.
13 is owned by the current virtual console.
14 To switch between the virtual consoles use the sequence
16 which means hold down ALT and press one of the function keys.
18 virtual console with the same number as the function key is then
19 selected as the current virtual console and given exclusive use of
20 the keyboard and display.
22 The console allows entering values that are not physically
23 present on the keyboard via a special keysequence.
24 To use this facility press and hold down ALT,
25 then enter a decimal number from 0-255 via the numerical keypad, then
27 The entered value is then used as the ASCII value for one
29 This way it is possible to enter any ASCII value, not present
31 The console driver also includes a history function.
33 pressing the scroll-lock key.
34 This holds the display, and enables the cursor
35 arrows for scrolling up and down through the last scrolled out lines.
37 The keyboard is configurable to suit the individual user and the different
40 The keys on the keyboard can have any of the following functions:
42 .Bl -tag -width "Modifier Key" -compact
44 Enter the ASCII value associated with the key.
46 Enter a string of ASCII values.
48 Switch virtual console.
50 Change the meaning of another key.
53 The keyboard is seen as a number of keys numbered from 1 to n.
55 number is often referred to as the "scancode" for a given key.
57 of the key is transmitted as an 8 bit char with bit 7 as 0 when a key is
58 pressed, and the number with bit 7 as 1 when released.
60 possible to make the mapping of the keys fully configurable.
62 The meaning of every key is programmable via the PIO_KEYMAP ioctl call, that
63 takes a structure keymap_t as argument.
64 The layout of this structure is as
67 .Bd -literal -offset indent
71 u_char map[NUM_STATES];
78 The field n_keys tells the system how many keydefinitions (scancodes)
80 Each scancode is then specified in the key_t substructure.
82 Each scancode can be translated to any of 8 different values, depending
83 on the shift, control, and alt state.
84 These eight possibilities are
85 represented by the map array, as shown below:
88 scan cntrl alt alt cntrl
89 code base shift cntrl shift alt shift cntrl shift
90 map[n] 0 1 2 3 4 5 6 7
91 ---- ------------------------------------------------------
92 0x1E 'a' 'A' 0x01 0x01 'a' 'A' 0x01 0x01
95 This is the default mapping for the key labelled 'A' which normally has
97 The eight states are as shown, giving the 'A' key its
99 The spcl field is used to give the key "special" treatment, and is
100 interpreted as follows.
101 Each bit corresponds to one of the states above.
103 key emits the number defined in the corresponding map[] entry.
104 If the bit is 1 the key is "special".
105 This means it does not emit
106 anything; instead it changes the "state".
107 That means it is a shift,
108 control, alt, lock, switch-screen, function-key or no-op key.
109 The bitmap is backwards i.e.,
110 7 for base, 6 for shift etc.
112 The flgs field defines if the key should react on caps-lock (1),
113 num-lock (2), both (3) or ignore both (0).
117 utility is used to load such a description into/outof
118 the kernel at runtime.
119 This makes it possible to change the key
120 assignments at runtime, or more important to get (GIO_KEYMAP ioctl)
121 the exact key meanings from the kernel (e.g.\& used by the X server).
123 The function keys can be programmed using the SETFKEY ioctl call.
125 This ioctl takes an argument of the type fkeyarg_t:
126 .Bd -literal -offset indent
134 The field keynum defines which function key that is programmed.
135 The array keydef should contain the new string to be used (MAXFK long),
136 and the length should be entered in flen.
138 The GETFKEY ioctl call works in a similar manner, except it returns
139 the current setting of keynum.
141 The function keys are numbered like this:
142 .Bd -literal -offset indent
144 Shift F1-F12 key 13 - 24
145 Ctrl F1-F12 key 25 - 36
146 Ctrl+shift F1-F12 key 37 - 48
169 utility also allows changing these values at runtime.
171 .An S\(/oren Schmidt Aq sos@FreeBSD.org