KEYBOARD(HW) XENIX System V KEYBOARD(HW)
Name
keyboard - The PC keyboard.
Description
The PC keyboard is used to enter data, switch screens, and
send certain control signals to the computer.
performs terminal emulation on the PC screen and keyboard,
and, in doing so, makes use of several particular keys and
key combinations. These keys and key combinations have
special names that are unique to the system, and may or may
not correspond to the keytop labels on your keyboard. These
keys are described later.
When you press a key, one of the following happens:
- An ASCII value is entered
- A string is sent to the computer.
- A function is initiated.
- The meaning of another key, or keys, is changed.
When a key is pressed (a keystroke), the keyboard sends a
scancode to the computer, it is interpreted by the keyboard
driver. The interpretation of key codes may be modified so
that keys can function differently from their default
actions.
There are three special occurrences, or keystrokes:
- Switch screens.
- Send signals.
- Change the value of previous character, characters or
string.
Switching Screens (Multiscreen)
To get to the next consecutive screen, enter Ctrl-PrtSc
using the Ctrl key, and the PrtSc key. Any active screen
may be selected by entering alt-Fn, where Fn is one of the
function keys. F1 refers to the PC display (/dev/tty01).
Page 1 (printed 2/7/91)
KEYBOARD(HW) XENIX System V KEYBOARD(HW)
Signals
A signal affects some process or processes. Examples of
signals are Ctrl-d (end of input, exits from shell), Ctrl-\
(quits a process), Ctrl-s (stop output to the screen), and
Ctrl-q (resume sending output).
Typically, characters are mapped to signals using stty(C).
The only way to map signals is using stty.
Altering Values
The actual code sent to the keyboard driver can be changed
by using certain keys in combination. For example, the
SHIFT key changes the ASCII values of the alphanumeric keys.
Holding down the Ctrl key while pressing another key sends a
control code (Ctrl-d, Ctrl-s, Ctrl-q, etc.).
Special Keys
To help you find the special keys, the following table shows
which keys on a typical console correspond to system keys.
In this table, a hyphen (-) between keys means `hold down
the first key while pressing the second.'
XENIX Name Keytop Action
INTR Del Stops current action
and returns to the
shell. This key is
also called the RUB OUT
or INTERRUPT key.
BACKSPACE <- Deletes the first
character to the left
of the cursor.
Note that the ``cursor
left'' key also has a
left arrow (<-) on its
keytop, but you cannot
backspace using that
key.
Ctrl-d Ctrl-d Signals the end of
input from the
keyboard; also exits
current shell.
Ctrl-h Ctrl-h Deletes the first
character to the left
of the cursor. Also
called the ERASE key.
Ctrl-q Ctrl-q Restarts printing after
it has been stopped
with Ctrl-s.
Page 2 (printed 2/7/91)
KEYBOARD(HW) XENIX System V KEYBOARD(HW)
Ctrl-s Ctrl-s Suspends printing on
the screen (does not
stop the program).
Ctrl-u Ctrl-u Deletes all characters
on the current line.
Also called the KILL
key.
Ctrl-\ Ctrl-\ Quits current command
and creates a core
file, if allowed.
(Recommended for
debugging only.)
ESCAPE Esc Special code for some
programs. For example,
changes from insert
mode to command mode in
the vi(C) text editor.
RETURN (down-left arrow Terminates a command
or ENTER) line and initiates an
action from the shell.
Fn Fn Function key n. F1-F12
are unshifted, F13-F24
are shifted F1-F12,
F25-F36 are Ctrl-F1
through F12, and F37-
F48 are Ctrl-Shift-F1
through F12.
The next Fn keys (F49-
F60) are on the number
pad (unshifted):
F49 - '7' F55 - '6'
F50 - '8' F56 - '+'
F51 - '9' F57 - '1'
F52 - '-' F58 - '2'
F53 - '4' F59 - '3'
F54 - '5' F60 - '0'
For keys F61 through
F96, see
/usr/lib/keyboard/strings.
These function keys are
not available on all
keyboards, but you can
map other keys to
represent them.
The keyboard mapping is performed through a structure
defined in /usr/include/sys/keyboard.h. Each key can have
ten states. The first eight are:
Page 3 (printed 2/7/91)
KEYBOARD(HW) XENIX System V KEYBOARD(HW)
- Base - Ctrl-Shift
- Shift - Alt-Shift
- Ctrl - Alt-Ctrl
- Alt - Alt-Ctrl-Shift
There are two additional states indicated by two special
bytes. The first is a ``special state'' byte whose bits
indicate whether the key is ``special'' in one or more of
the first eight states.
The second is one of four characters (C, N, B, O) which
indicate how the lock keys affect the particular key. This
is discussed further in the next section, ``Scan Codes.''
Keyboard Mode
Most keyboards normally are in a PC compatibility mode,
though some can be put into a native AT keyboard mode. The
utility kbmode(ADM) can be used to determine if a keyboard
supports AT mode, and can also be used to put the keyboard
into AT mode until the next time the system is rebooted. A
system can also be configured to boot with the keyboard in
AT mode with the configure(ADM) utility.
Enhanced keyboards are more fully programmable in AT mode.
Also, it recognizes two control keys and an alt key.
Scan Codes
The following table describes the default contents of
/usr/lib/keyboard/keys. The column headings are:
SCAN CODE - The scan code generated by the keyboard hardware
when a key is pressed. There is no user access to the scan
code generated by releasing a key.
BASE - The normal value of a key press.
SHIFT - The value of a key press when the SHIFT is also
being held down.
LOCK - Indicates which lock keys affect that particular key:
- C indicates Capslock
- N indicates Numlock
- B indicates both
- O indicates locking is off
Keys affected by the lock keys C, B, or N, send the shifted
value (scan code) of current state when that lock key is on.
When the shift key is depressed while a lock key is also on,
the key reverts (toggles) to its original state.
The other columns are the values of key presses when
Page 4 (printed 2/7/91)
KEYBOARD(HW) XENIX System V KEYBOARD(HW)
combinations of the CTRL, ALT and SHIFT keys are also held
down.
All values, except for keywords, are ASCII character values.
The keywords refer to the special function keys.
_________________________________________________________________
ALT
SCAN CTRL ALT ALT CTRL
CODE BASE SHIFT CTRL SHIFT ALT SHIFT CTRL SHIFT LOCK
_________________________________________________________________
0 nop nop nop nop nop nop nop nop O
1 esc esc nop nop esc esc nop nop O
2 '1' '!' nop nop '1' '!' nop nop O
3 '2' '@' nop nop '2' '@' nop nop O
4 '3' '#' nop nop '3' '#' nop nop O
5 '4' '$' nop nop '4' '$' nop nop O
6 '5' '%' nop nop '5' '%' nop nop O
7 '6' '^' rs rs '6' '^' rs rs O
8 '7' '&' nop nop '7' '&' nop nop O
9 '8' '*' nop nop '8' '*' nop nop O
10 '9' '(' nop nop '9' '(' nop nop O
11 '0' ')' nop nop '0' ')' nop nop O
12 '-' '_' ns ns '-' '_' ns ns O
13 '=' '+' nop nop '=' '+' nop nop O
14 bs bs del del bs bs del del O
15 ht btab nop nop ht btab nop nop O
16 'q' 'Q' dc1 dc1 'q' 'Q' dc1 dc1 C
17 'w' 'W' etb etb 'w' 'W' etb etb C
18 'e' 'E' enq enq 'e' 'E' enq enq C
19 'r' 'R' dc2 dc2 'r' 'R' dc2 dc2 C
20 't' 'T' dc4 dc4 't' 'T' dc4 dc4 C
21 'y' 'Y' em em 'y' 'Y' em em C
22 'u' 'U' nak nak 'u' 'U' nak nak C
23 'i' 'I' ht ht 'i' 'I' ht ht C
24 'o' 'O' si si 'o' 'O' si si C
25 'p' 'P' dle dle 'p' 'P' dle dle C
26 '[' '{' esc esc '[' '{' esc esc O
27 ']' '}' gs gs ']' '}' gs gs O
28 cr cr nl nl cr cr nl nl O
29 ctrl ctrl ctrl ctrl ctrl ctrl ctrl ctrl O
30 'a' 'A' soh soh 'a' 'A' soh soh C
31 's' 'S' dc3 dc3 's' 'S' dc3 dc3 C
32 'd' 'D' eot eot 'd' 'D' eot eot C
33 'f' 'F' ack ack 'f' 'F' ack ack C
34 'g' 'G' bel bel 'g' 'G' bel bel C
35 'h' 'H' bs bs 'h' 'H' bs bs C
36 'j' 'J' nl nl 'j' 'J' nl nl C
Page 5 (printed 2/7/91)
KEYBOARD(HW) XENIX System V KEYBOARD(HW)
37 'k' 'K' vt vt 'k' 'K' vt vt C
38 'l' 'L' np np 'l' 'L' np np C
39 ';' ':' nop nop ';' ':' nop nop O
40 '\'' '"' nop nop '\'' '"' nop nop O
41 '`' '~' nop nop '`' '~' nop nop O
42 lshift lshift lshift lshift lshift lshift lshift lshift O
43 '\\' '|' fs fs '\\' '|' fs fs O
44 'z' 'Z' sub sub 'z' 'Z' sub sub C
45 'x' 'X' can can 'x' 'X' can can C
46 'c' 'C' etx etx 'c' 'C' etx etx C
47 'v' 'V' syn syn 'v' 'V' syn syn C
48 'b' 'B' stx stx 'b' 'B' stx stx C
49 'n' 'N' so so 'n' 'N' so so C
50 'm' 'M' cr cr 'm' 'M' cr cr C
51 ',' '<' nop nop ',' '<' nop nop O
52 '.' '>' nop nop '.' '>' nop nop O
53 '/' '?' nop nop '/' '?' nop nop O
54 rshift rshift rshift rshift rshift rshift rshift rshift O
55 '*' '*' nscr nscr '*' '*' nscr nscr O
56 alt alt alt alt alt alt alt alt O
57 ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' O
58 clock clock clock clock clock clock clock clock O
59 fkey1 fkey13 fkey25 fkey37 scr1 scr11 scr1 scr11 O
60 fkey2 fkey14 fkey26 fkey38 scr2 scr12 scr2 scr12 O
61 fkey3 fkey15 fkey27 fkey39 scr3 scr13 scr3 scr13 O
62 fkey4 fkey16 fkey28 fkey40 scr4 scr14 scr4 scr14 O
63 fkey5 fkey17 fkey29 fkey41 scr5 scr15 scr5 scr15 O
64 fkey6 fkey18 fkey30 fkey42 scr6 scr16 scr6 scr16 O
65 fkey7 fkey19 fkey31 fkey43 scr7 scr7 scr7 scr7 O
66 fkey8 fkey20 fkey32 fkey44 scr8 scr8 scr8 scr8 O
67 fkey9 fkey21 fkey33 fkey45 scr9 scr9 scr9 scr9 O
68 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O
69 nlock nlock dc3 dc3 nlock nlock dc3 dc3 O
70 slock slock del del slock slock del del O
71 fkey49 '7' '7' '7' '7' '7' '7' '7' N
72 fkey50 '8' '8' '8' '8' '8' '8' '8' N
73 fkey51 '9' '9' '9' '9' '9' '9' '9' N
74 fkey52 '-' '-' '-' '-' '-' '-' '-' N
75 fkey53 '4' '4' '4' '4' '4' '4' '4' N
76 fkey54 '5' '5' '5' '5' '5' '5' '5' N
77 fkey55 '6' '6' '6' '6' '6' '6' '6' N
78 fkey56 '+' '+' '+' '+' '+' '+' '+' N
79 fkey57 '1' '1' '1' '1' '1' '1' '1' N
80 fkey58 '2' '2' '2' '2' '2' '2' '2' N
81 fkey59 '3' '3' '3' '3' '3' '3' '3' N
82 fkey60 '0' '0' '0' '0' '0' '0' '0' N
83 del '.' del del del del del del N
84 ns ns ns ns ns ns ns ns O
Page 6 (printed 2/7/91)
KEYBOARD(HW) XENIX System V KEYBOARD(HW)
85 nop nop nop nop nop nop nop nop O
86 nop nop nop nop nop nop nop nop O
The following scan codes exist only for keyboards which
support, and are in, native AT mode rather than PC
compatibility mode.
_________________________________________________________________
ALT
SCAN CTRL ALT ALT CTRL
CODE BASE SHIFT CTRL SHIFT ALT SHIFT CTRL SHIFT LOCK
_________________________________________________________________
87 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O
88 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O
89 nop nop nop nop nop nop nop nop O
90 nop nop nop nop nop nop nop nop O
91 nop nop nop nop nop nop nop nop O
92 nop nop nop nop nop nop nop nop O
93 nop nop nop nop nop nop nop nop O
94 nop nop nop nop nop nop nop nop O
95 nop nop nop nop nop nop nop nop O
96 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 O
97 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 O
98 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 O
99 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 O
100 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 O
101 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 O
102 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 O
103 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 O
104 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 O
105 del del del del del del del del N
106 fkey54 fkey54 fkey54 fkey54 fkey54 fkey54 fkey54 fkey54 O
107 nop nop nop nop nop nop nop nop O
108 nop nop nop nop nop nop nop nop O
109 nop nop nop nop nop nop nop nop O
110 nop nop nop nop nop nop nop nop O
111 nop nop nop nop nop nop nop nop O
112 nop nop nop nop nop nop nop nop O
113 nop nop nop nop nop nop nop nop O
114 nop nop nop nop nop nop nop nop O
115 nop nop nop nop nop nop nop nop O
116 nop nop nop nop nop nop nop nop O
117 nop nop nop nop nop nop nop nop O
118 nop nop nop nop nop nop nop nop O
119 nop nop nop nop nop nop nop nop O
120 nop nop nop nop nop nop nop nop O
121 nop nop nop nop nop nop nop nop O
Page 7 (printed 2/7/91)
KEYBOARD(HW) XENIX System V KEYBOARD(HW)
122 nop nop nop nop nop nop nop nop O
123 nop nop nop nop nop nop nop nop O
124 nop nop nop nop nop nop nop nop O
125 nop nop nop nop nop nop nop nop O
126 nop nop nop nop nop nop nop nop O
127 nop nop nop nop nop nop nop nop O
128 rctrl rctrl rctrl rctrl rctrl rctrl rctrl rctrl O
129 ralt ralt ralt ralt ralt ralt ralt ralt O
130 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 O
131 del del del del del del del del N
132 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 O
133 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 O
134 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 O
135 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 O
136 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 O
137 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 O
138 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 O
139 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 O
140 '/' nop nop nop '/' nop nop nop O
141 cr cr nl nl cr cr nl nl O
The next table lists the ``value'' of each of the special
keywords used in /usr/lib/keyboard/keys (and the preceding
table). mapkey(ADM) places a ``value'' in the ioctl buffer
during key mapping. The keywords are only used in the scan
code file (/usr/lib/keyboard/keys) for readability.
__________________________________________________________________
Name Value Meaning
__________________________________________________________________
nop 0 No operation - no action from keypress
lshift 2 Left hand shift
rshift 3 Right hand shift
clock 4 Caps lock
nlock 5 Numeric lock
slock 6 Scroll lock
alt 7 Alt key
btab 8 Back tab key - generates fixed sequence (esc [ Z)
ctrl 9 Control key
nscr 10 Switch to the next screen
scr1 11 Switch to screen #1
... ...
scr16 26 Switch to screen #16
fkey1 27 Function key #1
... ...
fkey96 122 Function key #96
rctl 128* Right Control Key
Page 8 (printed 2/7/91)
KEYBOARD(HW) XENIX System V KEYBOARD(HW)
ralt 129* Right Alt Key
* AT mode keyboard only.
This table lists names and decimal values that are
interchangeable in the mapkey file. Names are used in place
of numeric constants to make it easier to read the scan code
table. Again, only the decimal values are placed in the
ioctl buffer. These are taken from ascii(M).
____________|______________
Name Value| Name Value
____________|______________
nul 0 | dc1 17
soh 1 | dc2 18
stx 2 | dc3 19
etx 3 | dc4 20
eot 4 | nak 21
enq 5 | syn 22
ack 6 | etb 23
bel 7 | can 24
bs 8 | em 25
ht 9 | sub 26
nl 10 | esc 27
vt 11 | fs 28
np 12 | gs 29
cr 13 | rs 30
so 14 | ns 31
si 15 | del 127
dle 16 |
Keyboard Mapping
The PC keyboard is mapped as part of terminal emulation.
This kind of mapping is performed only on the computer
keyboard, not on remote terminals. Use mapkey to change
keyboard mapping. To change the mapping for individual
channels (multiscreens), use mapchan(M).
Keyboard mapping can also be performed using ioctl. The
syntax is the same as for string key mapping (see previous
section).
For keyboard mapping, cmd is GIO_KEYMAP to display the
current map, and PIO_KEYMAP puts the prepared buffer into
place.
Page 9 (printed 2/7/91)
KEYBOARD(HW) XENIX System V KEYBOARD(HW)
String Key Mapping
To map string (function) keys, use the mapstr (see
mapkey(ADM)) utility. mapstr modifies the string mapping
table where function keys are defined.
The string mapping table is an array of 512 bytes (typedef
strmap_t) containing null terminated strings that redefine
the function keys. The first null terminated string is
assigned to the first string key, the second string to the
second string key, and so on.
There is no limit to the length of any particular string as
long as the whole table does not exceed 512 bytes, including
nulls. Strings are made null by the introduction of extra
null characters.
The following is a list of default function key values:
___________________________________________________
| Default Function Key Values |
|__________________________________________________|
| |
| Shift Ctrl Ctrl |
| Key # Function Shift |
| Function Function Function|
|__________________________________________________|
| 1 ESC[M ESC[Y ESC[k ESC[w |
| 2 ESC[N ESC[Z ESC[l ESC[x |
| 3 ESC[O ESC[a ESC[m ESC[y |
| 4 ESC[P ESC[b ESC[n ESC[z |
| 5 ESC[Q ESC[c ESC[o ESC[@ |
| 6 ESC[R ESC[d ESC[p ESC[[ |
| 7 ESC[S ESC[e ESC[q ESC[\ |
| 8 ESC[T ESC[f ESC[r ESC[] |
| 9 ESC[U ESC[g ESC[s ESC[^ |
| 10 ESC[V ESC[h ESC[t ESC[_ |
| 11 ESC[W ESC[i ESC[u ESC[` |
| 12 ESC[X ESC[j ESC[v ESC[{ |
| |
|__________________________________________________|
__________________________________________
| Home ESC[H| End ESC[F|
| Up arrow ESC[A| Down arrow ESC[B|
| Page up ESC[I| Page down ESC[G|
| Left arrow ESC[D| 5 ESC[E|
| Right arrow ESC[C| Insert ESC[L|
|____________________|____________________|
You can also map string keys using ioctl(S). The syntax is:
#include <sys/keyboard.h>
Page 10 (printed 2/7/91)
KEYBOARD(HW) XENIX System V KEYBOARD(HW)
ioctl(fd,cmd,buf)
int fd, cmd;
char *buf;
...
For string key mapping where cmd is GIO_STRMAP to display
the string mapping table and PIO_STRMAP to put the new
string mapping table in place.
Files
/usr/lib/keyboard/keys
/usr/lib/keyboard/strings
See Also
mapchan(F), mapchan(M), mapkey(ADM), multiscreen(M),
screen(HW), setkey(C), stty(C), kbmode(ADM), configure(ADM)
Page 11 (printed 2/7/91)