1997-03-07 02:50:01 +00:00
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1997-03-07 02:50:01 +00:00
|
|
|
.\"
|
1995-01-12 11:47:05 +00:00
|
|
|
.Dd January 8, 1995
|
1999-11-15 23:14:32 +00:00
|
|
|
.Dt KEYBOARD 4
|
1993-09-09 00:32:25 +00:00
|
|
|
.Os FreeBSD
|
|
|
|
.Sh NAME
|
|
|
|
.Nm keyboard
|
|
|
|
.Nd pc keyboard interface
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
|
2000-03-01 14:50:24 +00:00
|
|
|
The PC keyboard is used as the console character input device.
|
|
|
|
The keyboard
|
1993-09-09 00:32:25 +00:00
|
|
|
is owned by the current virtual console.
|
|
|
|
To switch between the virtual consoles use the sequence
|
1998-06-29 07:04:08 +00:00
|
|
|
.Ar ALT+Fn ,
|
2000-03-01 14:50:24 +00:00
|
|
|
which means hold down ALT and press one of the function keys.
|
|
|
|
The
|
1993-09-09 00:32:25 +00:00
|
|
|
virtual console with the same number as the function key is then
|
1998-06-29 06:56:40 +00:00
|
|
|
selected as the current virtual console and given exclusive use of
|
1993-09-09 00:32:25 +00:00
|
|
|
the keyboard and display.
|
|
|
|
|
|
|
|
The console allows entering values that are not physically
|
|
|
|
present on the keyboard via a special keysequence.
|
|
|
|
To use this facility press and hold down ALT,
|
|
|
|
then enter a decimal number from 0-255 via the numerical keypad, then
|
2000-03-01 14:50:24 +00:00
|
|
|
release ALT.
|
|
|
|
The entered value is then used as the ASCII value for one
|
|
|
|
character.
|
|
|
|
This way it is possible to enter any ASCII value, not present
|
1994-02-01 06:22:29 +00:00
|
|
|
on the keyboard.
|
2000-03-01 14:50:24 +00:00
|
|
|
The console driver also includes a history function.
|
|
|
|
It is activated by
|
|
|
|
pressing the scroll-lock key.
|
|
|
|
This holds the display, and enables the cursor
|
1995-01-12 11:47:05 +00:00
|
|
|
arrows for scrolling up and down through the last scrolled out lines.
|
|
|
|
|
1993-09-09 00:32:25 +00:00
|
|
|
The keyboard is configurable to suit the individual user and the different
|
|
|
|
national layout.
|
|
|
|
|
|
|
|
The keys on the keyboard can have any of the following functions:
|
|
|
|
|
|
|
|
Normal key - Enter the ASCII value associated with the key.
|
|
|
|
|
|
|
|
Function key - Enter a string of ASCII values.
|
|
|
|
|
|
|
|
Switch Key - Switch virtual console.
|
|
|
|
|
|
|
|
Modifier Key - Change the meaning of another key.
|
|
|
|
|
|
|
|
|
|
|
|
The keyboard is seen as a number of keys numbered from 1 to n. This
|
2000-03-01 14:50:24 +00:00
|
|
|
number is often referred to as the "scancode" for a given key.
|
|
|
|
The number
|
1993-09-09 00:32:25 +00:00
|
|
|
of the key is transmitted as an 8 bit char with bit 7 as 0 when a key is
|
2000-03-01 14:50:24 +00:00
|
|
|
pressed, and the number with bit 7 as 1 when released.
|
|
|
|
This makes it
|
1993-09-09 00:32:25 +00:00
|
|
|
possible to make the mapping of the keys fully configurable.
|
|
|
|
|
|
|
|
The meaning of every key is programmable via the PIO_KEYMAP ioctl call, that
|
2000-03-01 14:50:24 +00:00
|
|
|
takes a structure keymap_t as argument.
|
|
|
|
The layout of this structure is as
|
1993-09-09 00:32:25 +00:00
|
|
|
follows:
|
|
|
|
.Pp
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct keymap {
|
|
|
|
u_short n_keys;
|
|
|
|
struct key_t {
|
|
|
|
u_char map[NUM_STATES];
|
|
|
|
u_char spcl;
|
|
|
|
u_char flgs;
|
|
|
|
} key[NUM_KEYS];
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
The field n_keys tells the system how many keydefinitions (scancodes)
|
2000-03-01 14:50:24 +00:00
|
|
|
follows.
|
|
|
|
Each scancode is then specified in the key_t substructure.
|
1993-09-09 00:32:25 +00:00
|
|
|
|
|
|
|
Each scancode can be translated to any of 8 different values, depending
|
2000-03-01 14:50:24 +00:00
|
|
|
on the shift, control, and alt state.
|
|
|
|
These eight possibilities are
|
1993-09-09 00:32:25 +00:00
|
|
|
represented by the map array, as shown below:
|
|
|
|
|
|
|
|
alt
|
|
|
|
scan cntrl alt alt cntrl
|
|
|
|
code base shift cntrl shift alt shift cntrl shift
|
|
|
|
map[n] 0 1 2 3 4 5 6 7
|
|
|
|
---- ------------------------------------------------------
|
|
|
|
0x1E 'a' 'A' 0x01 0x01 'a' 'A' 0x01 0x01
|
|
|
|
|
1998-06-08 06:12:02 +00:00
|
|
|
This is the default mapping for the key labelled 'A' which normally has
|
1998-06-29 06:56:40 +00:00
|
|
|
scancode 0x1E. The eight states are as shown, giving the 'A' key its
|
1993-09-09 00:32:25 +00:00
|
|
|
normal behavior.
|
|
|
|
The spcl field is used to give the key "special" treatment, and is
|
|
|
|
interpreted as follows.
|
2000-03-01 14:50:24 +00:00
|
|
|
Each bit corresponds to one of the states above.
|
|
|
|
If the bit is 0 the
|
1993-09-09 00:32:25 +00:00
|
|
|
key emits the number defined in the corresponding map[] entry.
|
|
|
|
If the bit is 1 the key is "special". This means it does not emit
|
1998-06-29 06:56:40 +00:00
|
|
|
anything; instead it changes the "state". That means it is a shift,
|
1993-09-09 00:32:25 +00:00
|
|
|
control, alt, lock, switch-screen, function-key or no-op key.
|
|
|
|
The bitmap is backwards ie. 7 for base, 6 for shift etc.
|
|
|
|
|
|
|
|
The flgs field defines if the key should react on caps-lock (1),
|
|
|
|
num-lock (2), both (3) or ignore both (0).
|
|
|
|
|
1998-06-29 07:04:08 +00:00
|
|
|
The
|
|
|
|
.Xr kbdcontrol 1
|
|
|
|
utility is used to load such a description into/outof
|
2000-03-01 14:50:24 +00:00
|
|
|
the kernel at runtime.
|
|
|
|
This makes it possible to change the key
|
1993-09-09 00:32:25 +00:00
|
|
|
assignments at runtime, or more important to get (GIO_KEYMAP ioctl)
|
|
|
|
the exact key meanings from the kernel (fx. used by the X server).
|
|
|
|
|
1997-03-09 20:53:20 +00:00
|
|
|
The function keys can be programmed using the SETFKEY ioctl call.
|
1993-09-09 00:32:25 +00:00
|
|
|
|
|
|
|
This ioctl takes a argument of the type fkeyarg_t:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct fkeyarg {
|
|
|
|
u_short keynum;
|
|
|
|
char keydef[MAXFK];
|
|
|
|
char flen;
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
The field keynum defines which function key that is programmed.
|
|
|
|
The array keydef should contain the new string to be used (MAXFK long),
|
|
|
|
and the length should be entered in flen.
|
|
|
|
|
1998-06-29 06:56:40 +00:00
|
|
|
The GETFKEY ioctl call works in a similar manner, except it returns
|
1993-09-09 00:32:25 +00:00
|
|
|
the current setting of keynum.
|
|
|
|
|
|
|
|
The function keys are numbered like this:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
F1-F12 key 1 - 12
|
|
|
|
Shift F1-F12 key 13 - 24
|
|
|
|
Ctrl F1-F12 key 25 - 36
|
|
|
|
Ctrl+shift F1-F12 key 37 - 48
|
|
|
|
|
|
|
|
Home key 49
|
|
|
|
Up arrow key 50
|
|
|
|
Page Up key 51
|
|
|
|
(keypad) - key 52
|
|
|
|
Left arrow key 53
|
1995-01-28 22:18:05 +00:00
|
|
|
(keypad) 5 key 54
|
1993-09-09 00:32:25 +00:00
|
|
|
Right arrow key 55
|
|
|
|
(keypad) + key 56
|
|
|
|
End key 57
|
|
|
|
Down arrow key 58
|
|
|
|
Page down key 59
|
|
|
|
Insert key 60
|
1995-03-30 00:22:29 +00:00
|
|
|
Delete key 61
|
1995-01-28 22:18:05 +00:00
|
|
|
|
1995-03-30 00:22:29 +00:00
|
|
|
Right window key 62
|
|
|
|
Left window key 63
|
|
|
|
Menu key 64
|
1993-09-09 00:32:25 +00:00
|
|
|
.Ed
|
1995-01-12 11:47:05 +00:00
|
|
|
|
1998-06-29 07:04:08 +00:00
|
|
|
The
|
|
|
|
.Xr kbdcontrol 1
|
|
|
|
utility also allows changing these values at runtime.
|
1993-09-09 00:32:25 +00:00
|
|
|
.Pp
|
1998-03-12 07:31:21 +00:00
|
|
|
.Sh AUTHORS
|
2000-11-14 13:09:12 +00:00
|
|
|
.An S\(/oren Schmidt Aq sos@FreeBSD.org
|