periodic: Remove obsolete daily/status-named and weekly/clean-kvmdb
[dragonfly.git] / share / man / man4 / keyboard.4
1 .\"
2 .\" $FreeBSD: src/share/man/man4/keyboard.4,v 1.19.2.5 2001/08/17 13:08:38 ru Exp $
3 .\"
4 .Dd January 8, 1995
5 .Dt KEYBOARD 4
6 .Os
7 .Sh NAME
8 .Nm keyboard
9 .Nd pc keyboard interface
10 .Sh DESCRIPTION
11 The PC keyboard is used as the console character input device.
12 The keyboard
13 is owned by the current virtual console.
14 To switch between the virtual consoles use the sequence
15 .Ar ALT+Fn ,
16 which means hold down ALT and press one of the function keys.
17 The
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.
21 .Pp
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
26 release ALT.
27 The entered value is then used as the ASCII value for one
28 character.
29 This way it is possible to enter any ASCII value, not present
30 on the keyboard.
31 The console driver also includes a history function.
32 It is activated by
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.
36 .Pp
37 The keyboard is configurable to suit the individual user and the different
38 national layout.
39 .Pp
40 The keys on the keyboard can have any of the following functions:
41 .Pp
42 .Bl -tag -width "Modifier Key" -compact
43 .It "Normal key"
44 Enter the ASCII value associated with the key.
45 .It "Function key"
46 Enter a string of ASCII values.
47 .It "Switch Key"
48 Switch virtual console.
49 .It "Modifier Key"
50 Change the meaning of another key.
51 .El
52 .Pp
53 The keyboard is seen as a number of keys numbered from 1 to n. This
54 number is often referred to as the "scancode" for a given key.
55 The number
56 of the key is transmitted as an 8 bit char with bit 7 as 0 when a key is
57 pressed, and the number with bit 7 as 1 when released.
58 This makes it
59 possible to make the mapping of the keys fully configurable.
60 .Pp
61 The meaning of every key is programmable via the
62 .Dv PIO_KEYMAP
63 ioctl call, that
64 takes a structure keymap_t as argument.
65 The layout of this structure is as
66 follows:
67 .Bd -literal -offset indent
68                 struct keymap {
69                         u_short n_keys;
70                         struct key_t {
71                                 u_char map[NUM_STATES];
72                                 u_char spcl;
73                                 u_char flgs;
74                         } key[NUM_KEYS];
75                 };
76 .Ed
77 .Pp
78 The field n_keys tells the system how many keydefinitions (scancodes)
79 follows.
80 Each scancode is then specified in the key_t substructure.
81 .Pp
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:
86 .Bd -literal
87                                                             alt
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
93 .Ed
94 .Pp
95 This is the default mapping for the key labelled 'A' which normally has
96 scancode 0x1E. The eight states are as shown, giving the 'A' key its
97 normal behavior.
98 The spcl field is used to give the key "special" treatment, and is
99 interpreted as follows.
100 Each bit corresponds to one of the states above.
101 If the bit is 0 the
102 key emits the number defined in the corresponding map[] entry.
103 If the bit is 1 the key is "special". This means it does not emit
104 anything; instead it changes the "state". That means it is a shift,
105 control, alt, lock, switch-screen, function-key or no-op key.
106 The bitmap is backwards ie. 7 for base, 6 for shift etc.
107 .Pp
108 The flgs field defines if the key should react on caps-lock (1),
109 num-lock (2), both (3) or ignore both (0).
110 .Pp
111 The
112 .Xr kbdcontrol 1
113 utility is used to load such a description into/outof
114 the kernel at runtime.
115 This makes it possible to change the key
116 assignments at runtime, or more important to get
117 .Dv ( GIO_KEYMAP
118 ioctl)
119 the exact key meanings from the kernel (fx. used by the X server).
120 .Pp
121 The function keys can be programmed using the
122 .Dv SETFKEY
123 ioctl call.
124 .Pp
125 This ioctl takes an argument of the type fkeyarg_t:
126 .Bd -literal -offset indent
127                 struct fkeyarg {
128                         u_short keynum;
129                         char    keydef[MAXFK];
130                         char    flen;
131                 };
132 .Ed
133 .Pp
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.
137 .Pp
138 The
139 .Dv GETFKEY
140 ioctl call works in a similar manner, except it returns
141 the current setting of keynum.
142 .Pp
143 The function keys are numbered like this:
144 .Bd -literal -offset indent
145         F1-F12                  key 1 - 12
146         Shift F1-F12            key 13 - 24
147         Ctrl F1-F12             key 25 - 36
148         Ctrl+shift F1-F12       key 37 - 48
149
150         Home                    key 49
151         Up arrow                key 50
152         Page Up                 key 51
153         (keypad) -              key 52
154         Left arrow              key 53
155         (keypad) 5              key 54
156         Right arrow             key 55
157         (keypad) +              key 56
158         End                     key 57
159         Down arrow              key 58
160         Page down               key 59
161         Insert                  key 60
162         Delete                  key 61
163
164         Right window            key 62
165         Left window             key 63
166         Menu                    key 64
167 .Ed
168 .Pp
169 The
170 .Xr kbdcontrol 1
171 utility also allows changing these values at runtime.
172 .Sh AUTHORS
173 .An S\(/oren Schmidt Aq Mt sos@FreeBSD.org