DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

keyboard(HW)


keyboard -- the PC keyboard

Description

The PC keyboard is used to enter data, switch screens, and send certain control signals to the computer. The operating system 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 UNIX systems, 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:

When a key is pressed (a keystroke), the keyboard sends a scancode to the computer. This scancode is interpreted by the keyboard driver. The interpretation of scancodes may be modified so that keys can function differently from their default actions.

There are three special occurrences, or keystrokes, which do the following:

Switching screens (Multiscreen)

To get to the next consecutive screen, enter <Ctrl><PrtSc>. 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).

Handling signals

The keyboard driver recognizes input interrupt characters and sends the appropriate signal to all processes that have the terminal as their control terminal.

Examples of interrupt characters are INTR and QUIT, which terminate a running process by sending the signals SIGINT and SIGQUIT to the process group associated with the terminal.

Typically, characters are mapped to signals using stty(C) or ioctl(S) (see termio(M)). Note that some programs disable the special interpretation of these characters.

Functions such as ERASE, KILL, and XON/XOFF are not related to signals (see ``Special keys'' below).

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 UNIX system keys. These are examples and can differ between shells, applications, and so forth.

UNIX 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 LEFT ARROW Deletes the first character to the left of the cursor. Note that the ``cursor left'' key also has a left arrow (LEFT ARROW) on its keytop, but you cannot backspace using that key.
EOF <Ctrl>D Signals the end of input from the keyboard; also exits current shell.
ERASE <Ctrl>H Deletes the first character to the left of the cursor.
XON <Ctrl>Q Restarts printing after it has been stopped with <Ctrl>S.
XOFF <Ctrl>S Suspends printing on the screen (does not stop the program).
KILL <Ctrl>U Deletes all characters on the current line.
QUIT <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 <Return> or
<Enter>
Terminates a command 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>.
Keys <F49>-<F60> are on the number pad (unshifted):

<F49> -- 7 <F53> -- 4 <F57> -- 1
<F50> -- 8 <F54> -- 5 <F58> -- 2
<F51> -- 9 <F55> -- 6 <F59> -- 3
<F52> -- - <F56> -- + <F60> -- 0

Keys <F61> through <F96> (see
/usr/lib/keyboard/strings).

 +----------+-----------+-------------------------------------------+
 |UNIX 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.                           |
 +----------+-----------+-------------------------------------------+
 |EOF       | CtrlD     | Signals the end of input from the         |
 |          |           | keyboard; also exits current shell.       |
 +----------+-----------+-------------------------------------------+
 |ERASE     | CtrlH     | Deletes the first character to the left   |
 |          |           | of the cursor.                            |
 +----------+-----------+-------------------------------------------+
 |XON       | CtrlQ     | Restarts printing after it has been       |
 |          |           | stopped with CtrlS.                       |
 +----------+-----------+-------------------------------------------+
 |XOFF      | CtrlS     | Suspends printing on the screen (does not |
 |          |           | stop the program).                        |
 +----------+-----------+-------------------------------------------+
 |KILL      | CtrlU     | Deletes all characters on the current     |
 |          |           | line.                                     |
 +----------+-----------+-------------------------------------------+
 |QUIT      | 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    | Return or | Terminates a command line and initiates   |
 |          | Enter     | an action from the shell.                 |
 +----------+-----------+-------------------------------------------+
 |Fn        | Fn        | Function key n.  F1-F12 are unshifted,    |
 |          |           | F13-F24 are shifted F1-F12, F25-F36 are   |
 |          |           | CtrlF1 through F12, and F37-F48 are       |
 |          |           | CtrlShiftF1 through F12.                  |
 |          |           | Keys F49-F60 are on the number pad        |
 |          |           | (unshifted):                              |
 |          |           | F49  7    F53  4    F57  1                |
 |          |           | F50  8    F54  5    F58  2                |
 |          |           | F51  9    F55  6    F59  3                |
 |          |           | F52  -    F56  +    F60  0                |
 |          |           | Keys F61 through F96 (see                 |
 |          |           | /usr/lib/keyboard/strings).               |
 +----------+-----------+-------------------------------------------+
The keyboard mapping is performed through a structure defined in /usr/include/sys/keyboard.h. Each key can have ten states, generated by holding down the key itself and (optionally) one or more additional keys. The first eight are:

Base, where ``Base'' indicates just the key on its own
<Shift>
<Ctrl>
<Alt>
<Ctrl><Shift>
<Alt><Shift>
<Alt><Ctrl>
<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 section, ``Scan codes.''

Keyboard mode

Most keyboards are normally in a PC compatibility mode, though some can be put into a native AT keyboard mode. The UNIX 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 programmable in AT mode. Also, two <Ctrl> keys and an <Alt> key can be recognized in AT mode.

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> key 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 combinations of the <Ctrl>, <Alt> and <Shift> keys are also held down.

The plus (+) indicates that 8-bit keyboard mode is used (also known as ``meta mode''). In this mode (the default) the high bit is enabled. To disable the high bit (reverting to 7-bit mode) or to send ESC instead of the high bit, you can edit the /etc/conf/pack.d/cn/space.h file and change the value of cn_meta_mode (described in the file comments). You must relink the kernel and reboot after changing space.h.

All values, except for keywords, are ASCII character values. The keywords refer to the special function keys.

                ALT  
SCAN       CNTRL   ALT ALT CNTRL LOCK
CODE BASE SHIFT CNTRL SHIFT ALT SHIFT CNTRL SHIFT STATE
0 nop nop nop nop nop nop nop nop O+
1 esc esc esc esc esc esc esc esc O+
2 '1' '!' nop nop '1' '!' nop nop O+
3 '2' ' ' nul nul '2' ' ' nul
nul 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 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl 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' debug 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+
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 lalt lalt lalt lalt lalt lalt lalt lalt 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 '-' fkey92 fkey92 fkey95 fkey95 fkey95 fkey95 N+
75 fkey53 '4' '4' '4' '4' '4' '4' '4' N+
76 fkey54 '5' fkey91 fkey91 fkey94 fkey94 fkey94 fkey94 N+
77 fkey55 '6' '6' '6' '6' '6' '6' '6' N+
78 fkey56 '+' fkey93 fkey93 fkey96 fkey96 fkey96 fkey96 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+
85 nop nop nop nop nop nop nop nop O+
86 nop nop nop nop nop nop nop nop O+

                                                                       ALT
 SCAN                              CNTRL             ALT      ALT      CNTRL    LOCK
 CODE   BASE     SHIFT    CNTRL    SHIFT    ALT      SHIFT    CNTRL    SHIFT    STATE
 0      nop      nop      nop      nop      nop      nop      nop      nop      O+
 1      esc      esc      esc      esc      esc      esc      esc      esc      O+
 2      '1'      '!'      nop      nop      '1'      '!'      nop      nop      O+
 3      '2'      '        '        nul      nul      '2'      '        '        nul
 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     lctrl    lctrl    lctrl    lctrl    lctrl    lctrl    lctrl    lctrl    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'      debug    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+
 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     lalt     lalt     lalt     lalt     lalt     lalt     lalt     lalt     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   '-'      fkey92   fkey92   fkey95   fkey95   fkey95   fkey95   N+
 75     fkey53   '4'      '4'      '4'      '4'      '4'      '4'      '4'      N+
 76     fkey54   '5'      fkey91   fkey91   fkey94   fkey94   fkey94   fkey94   N+
 77     fkey55   '6'      '6'      '6'      '6'      '6'      '6'      '6'      N+
 78     fkey56   '+'      fkey93   fkey93   fkey96   fkey96   fkey96   fkey96   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+
 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       CNTRL   ALT ALT CNTRL LOCK
CODE BASE SHIFT CNTRL SHIFT ALT SHIFT CNTRL SHIFT STATE
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 fkey62 fkey72 fkey50 fkey82 fkey62 fkey72 fkey50 O+
97 fkey53 fkey64 fkey74 fkey53 fkey84 fkey64 fkey74 fkey53 O+
98 fkey58 fkey67 fkey77 fkey58 fkey87 fkey67 fkey77 fkey58 O+
99 fkey55 fkey65 fkey75 fkey55 fkey85 fkey65 fkey75 fkey55 O+
100 fkey49 fkey61 fkey71 fkey49 fkey81 fkey61 fkey71 fkey49 O+
101 fkey51 fkey63 fkey73 fkey51 fkey83 fkey63 fkey73 fkey51 O+
102 fkey57 fkey66 fkey76 fkey57 fkey86 fkey66 fkey76 fkey57 O+
103 fkey59 fkey68 fkey78 fkey59 fkey88 fkey68 fkey78 fkey59 O+
104 fkey60 fkey69 fkey79 fkey60 fkey89 fkey69 fkey79 fkey60 O+
105 del fkey70 fkey80 del fkey90 fkey70 fkey80 del O+
106 fkey54 fkey54 fkey93 fkey54 fkey96 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+
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 fkey69 fkey79 fkey60 fkey89 fkey69 fkey79 fkey60 O+
131 del fkey70 fkey80 del fkey90 fkey70 fkey80 del O+
132 fkey49 fkey61 fkey71 fkey49 fkey81 fkey61 fkey71 fkey49 O+
133 fkey57 fkey66 fkey76 fkey57 fkey86 fkey66 fkey76 fkey57 O+
134 fkey51 sbfs fkey73 sbhs fkey83 sbln fkey73 fkey51 O+
135 fkey59 sffs fkey78 sfhs fkey88 sfln fkey78 fkey59 O+
136 fkey55 fkey65 fkey75 fkey55 fkey85 fkey65 fkey75 fkey55 O+
137 fkey53 fkey64 fkey74 fkey53 fkey84 fkey64 fkey74 fkey53 O+
138 fkey50 fkey62 fkey72 fkey50 fkey82 fkey62 fkey72 fkey50 O+
139 fkey58 fkey67 fkey77 fkey58 fkey87 fkey67 fkey77 fkey58 O+
140 '/' nop nop nop '/' nop nop nop O+
141 cr cr nl nl cr cr nl nl O+
142 lwin lwin lwin lwin lwin lwin lwin lwin O+
143 rwin rwin rwin rwin rwin rwin rwin rwin O+
144 menu menu menu menu menu menu menu menu O+
145 power power power power power power power power O+
146 sleep sleep sleep sleep sleep sleep sleep sleep O+
147 wake wake wake wake wake wake wake wake O+

                                                                       ALT
 SCAN                              CNTRL             ALT      ALT      CNTRL    LOCK
 CODE   BASE     SHIFT    CNTRL    SHIFT    ALT      SHIFT    CNTRL    SHIFT    STATE
 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   fkey62   fkey72   fkey50   fkey82   fkey62   fkey72   fkey50   O+
 97     fkey53   fkey64   fkey74   fkey53   fkey84   fkey64   fkey74   fkey53   O+
 98     fkey58   fkey67   fkey77   fkey58   fkey87   fkey67   fkey77   fkey58   O+
 99     fkey55   fkey65   fkey75   fkey55   fkey85   fkey65   fkey75   fkey55   O+
 100    fkey49   fkey61   fkey71   fkey49   fkey81   fkey61   fkey71   fkey49   O+
 101    fkey51   fkey63   fkey73   fkey51   fkey83   fkey63   fkey73   fkey51   O+
 102    fkey57   fkey66   fkey76   fkey57   fkey86   fkey66   fkey76   fkey57   O+
 103    fkey59   fkey68   fkey78   fkey59   fkey88   fkey68   fkey78   fkey59   O+
 104    fkey60   fkey69   fkey79   fkey60   fkey89   fkey69   fkey79   fkey60   O+
 105    del      fkey70   fkey80   del      fkey90   fkey70   fkey80   del      O+
 106    fkey54   fkey54   fkey93   fkey54   fkey96   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+
 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   fkey69   fkey79   fkey60   fkey89   fkey69   fkey79   fkey60   O+
 131    del      fkey70   fkey80   del      fkey90   fkey70   fkey80   del      O+
 132    fkey49   fkey61   fkey71   fkey49   fkey81   fkey61   fkey71   fkey49   O+
 133    fkey57   fkey66   fkey76   fkey57   fkey86   fkey66   fkey76   fkey57   O+
 134    fkey51   sbfs     fkey73   sbhs     fkey83   sbln     fkey73   fkey51   O+
 135    fkey59   sffs     fkey78   sfhs     fkey88   sfln     fkey78   fkey59   O+
 136    fkey55   fkey65   fkey75   fkey55   fkey85   fkey65   fkey75   fkey55   O+
 137    fkey53   fkey64   fkey74   fkey53   fkey84   fkey64   fkey74   fkey53   O+
 138    fkey50   fkey62   fkey72   fkey50   fkey82   fkey62   fkey72   fkey50   O+
 139    fkey58   fkey67   fkey77   fkey58   fkey87   fkey67   fkey77   fkey58   O+
 140    '/'      nop      nop      nop      '/'      nop      nop      nop      O+
 141    cr       cr       nl       nl       cr       cr       nl       nl       O+
 142    lwin     lwin     lwin     lwin     lwin     lwin     lwin     lwin     O+
 143    rwin     rwin     rwin     rwin     rwin     rwin     rwin     rwin     O+
 144    menu     menu     menu     menu     menu     menu     menu     menu     O+
 145    power    power    power    power    power    power    power    power    O+
 146    sleep    sleep    sleep    sleep    sleep    sleep    sleep    sleep    O+
 147    wake     wake     wake     wake     wake     wake     wake     wake     O+

The next table lists the ``value'' of each of the special keywords used in /usr/lib/keyboard/keys (and the preceding table). mapkey(M) 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 <Capslock>
nlock 5 <Numlock>
slock 6 <Scroll lock>
alt 7 <Alt> key
btab 8 Back tab key -- generates fixed sequence (ESC [ Z)
ctrl 9 <Ctrl> key
nscr 10 Switch to the next screen
pscr 126 " previous
scr1 11 Switch to screen #1
... ...
scr16 26 Switch to screen #16
fkey1 27 Function key #1
... ...
fkey96 122 Function key #96
rctl 123* Right <Ctrl> Key
ralt 124* Right <Alt> Key
debug 125 Enter kernel debugger (if enabled)
sffs 127 Scroll forward full screen
sfhs 128 Scroll forward half screen
sfln 129 Scroll forward one line
sbfs 130 Scroll backward a screen
sbhs 131 Scroll backward half a screen
sbln 132 Scroll backward one line
lwin 133+ Left windows key
rwin 134+ Right windows key
menu 135+ Windows context menu key
sleep 136+ Powersave key
power 137+ Sleep key
wake 138+ Wakeup key

 +-------+-------+--------------------------------------------------+
 |Name   | Value | Meaning                                          |
 +-------+-------+--------------------------------------------------+
 |nop    |     0 | No operation  no action from keypress            |
 +-------+-------+--------------------------------------------------+
 |lshift |     2 | Left-hand shift                                  |
 +-------+-------+--------------------------------------------------+
 |rshift |     3 | Right-hand shift                                 |
 +-------+-------+--------------------------------------------------+
 |clock  |     4 | Capslock                                         |
 +-------+-------+--------------------------------------------------+
 |nlock  |     5 | Numlock                                          |
 +-------+-------+--------------------------------------------------+
 |slock  |     6 | Scroll lock                                      |
 +-------+-------+--------------------------------------------------+
 |alt    |     7 | Alt key                                          |
 +-------+-------+--------------------------------------------------+
 |btab   |     8 | Back tab key  generates fixed sequence (ESC [ Z) |
 +-------+-------+--------------------------------------------------+
 |ctrl   |     9 | Ctrl key                                         |
 +-------+-------+--------------------------------------------------+
 |nscr   |    10 | Switch to the next screen                        |
 +-------+-------+--------------------------------------------------+
 |pscr   |   126 | " previous                                       |
 +-------+-------+--------------------------------------------------+
 |scr1   |    11 | Switch to screen #1                              |
 +-------+-------+--------------------------------------------------+
 |...    |       | ...                                              |
 +-------+-------+--------------------------------------------------+
 |scr16  |    26 | Switch to screen #16                             |
 +-------+-------+--------------------------------------------------+
 |fkey1  |    27 | Function key #1                                  |
 +-------+-------+--------------------------------------------------+
 |...    |       | ...                                              |
 +-------+-------+--------------------------------------------------+
 |fkey96 |   122 | Function key #96                                 |
 +-------+-------+--------------------------------------------------+
 |rctl   |  123* | Right Ctrl Key                                   |
 +-------+-------+--------------------------------------------------+
 |ralt   |  124* | Right Alt Key                                    |
 +-------+-------+--------------------------------------------------+
 |debug  |   125 | Enter kernel debugger (if enabled)               |
 +-------+-------+--------------------------------------------------+
 |sffs   |   127 | Scroll forward full screen                       |
 +-------+-------+--------------------------------------------------+
 |sfhs   |   128 | Scroll forward half screen                       |
 +-------+-------+--------------------------------------------------+
 |sfln   |   129 | Scroll forward one line                          |
 +-------+-------+--------------------------------------------------+
 |sbfs   |   130 | Scroll backward a screen                         |
 +-------+-------+--------------------------------------------------+
 |sbhs   |   131 | Scroll backward half a screen                    |
 +-------+-------+--------------------------------------------------+
 |sbln   |   132 | Scroll backward one line                         |
 +-------+-------+--------------------------------------------------+
 |lwin   |   133 | Left windows key                                 |
 +-------+-------+--------------------------------------------------+
 |rwin   |   134 | Right windows key                                |
 +-------+-------+--------------------------------------------------+
 |menu   |   135 | Windows context menu key                         |
 +-------+-------+--------------------------------------------------+
 |sleep  |   136 | Powersave key                                    |
 +-------+-------+--------------------------------------------------+
 |power  |   137 | Sleep key                                        |
 +-------+-------+--------------------------------------------------+
 |wake   |   138 | Wakeup key                                       |
 +-------+-------+--------------------------------------------------+

*
AT-style 101/102 key keyboard only.

+
Windows keyboards only; these have no function under SCO OpenServer.

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    

 +---------+--------------+----------+-------------------+
 |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 the section ``String key mapping'').

For keyboard mapping, cmd is GIO_KEYMAP to display the current map, and PIO_KEYMAP puts the prepared buffer into place.

String key mapping

To map string (function) keys, use the mapstr (see the mapkey(M) manual page) 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:

Key number Function key Function
1 <F1> ESC[M
2 <F2> ESC[N
3 <F3> ESC[O
4 <F4> ESC[P
5 <F5> ESC[Q
6 <F6> ESC[R
7 <F7> ESC[S
8 <F8> ESC[T
9 <F9> ESC[U
10 <F10> ESC[V
11 <F11> ESC[W
12 <F12> ESC[X
13 <Shift><F1> ESC[Y
14 <Shift><F2> ESC[Z
15 <Shift><F3> ESC[a
16 <Shift><F4> ESC[b
17 <Shift><F5> ESC[c
18 <Shift><F6> ESC[d
19 <Shift><F7> ESC[e
20 <Shift><F8> ESC[f
21 <Shift><F9> ESC[g
22 <Shift><F10> ESC[h
23 <Shift><F11> ESC[i
24 <Shift><F12> ESC[j
25 <Ctrl><F1> ESC[k
26 <Ctrl><F2> ESC[l
27 <Ctrl><F3> ESC[m
28 <Ctrl><F4> ESC[n
29 <Ctrl><F5> ESC[o
30 <Ctrl><F6> ESC[p
31 <Ctrl><F7> ESC[q
32 <Ctrl><F8> ESC[r
33 <Ctrl><F9> ESC[s
34 <Ctrl><F10> ESC[t
35 <Ctrl><F11> ESC[u
36 <Ctrl><F12> ESC[v
37 <Ctrl><Shift><F1> ESC[w
38 <Ctrl><Shift><F2> ESC[x
39 <Ctrl><Shift><F3> ESC[y
40 <Ctrl><Shift><F4> ESC[z
41 <Ctrl><Shift><F5> ESC[@
42 <Ctrl><Shift><F6> ESC[[
43 <Ctrl><Shift><F7> ESC[\
44 <Ctrl><Shift><F8> ESC[]
45 <Ctrl><Shift><F9> ESC[[^]
46 <Ctrl><Shift><F10> ESC[_
47 <Ctrl><Shift><F11> ESC[`
48 <Ctrl><Shift><F12> ESC[{
49 <Home> ESC[H
50 UP ARROW ESC[A
51 <PgUp> ESC[I
52 <-> -
53 LEFT ARROW ESC[D
54 <5> ESC[E
55 -> ESC[C
56 <+> +
57 <End> ESC[F
58 DOWN ARROW ESC[B
59 <PgDn> ESC[G
60 <Ins> ESC[L

 +-----------+--------------+----------+
 |Key number | Function key | Function |
 +-----------+--------------+----------+
 |1          | F1           | ESC[M    |
 +-----------+--------------+----------+
 |2          | F2           | ESC[N    |
 +-----------+--------------+----------+
 |3          | F3           | ESC[O    |
 +-----------+--------------+----------+
 |4          | F4           | ESC[P    |
 +-----------+--------------+----------+
 |5          | F5           | ESC[Q    |
 +-----------+--------------+----------+
 |6          | F6           | ESC[R    |
 +-----------+--------------+----------+
 |7          | F7           | ESC[S    |
 +-----------+--------------+----------+
 |8          | F8           | ESC[T    |
 +-----------+--------------+----------+
 |9          | F9           | ESC[U    |
 +-----------+--------------+----------+
 |10         | F10          | ESC[V    |
 +-----------+--------------+----------+
 |11         | F11          | ESC[W    |
 +-----------+--------------+----------+
 |12         | F12          | ESC[X    |
 +-----------+--------------+----------+
 |13         | ShiftF1      | ESC[Y    |
 +-----------+--------------+----------+
 |14         | ShiftF2      | ESC[Z    |
 +-----------+--------------+----------+
 |15         | ShiftF3      | ESC[a    |
 +-----------+--------------+----------+
 |16         | ShiftF4      | ESC[b    |
 +-----------+--------------+----------+
 |17         | ShiftF5      | ESC[c    |
 +-----------+--------------+----------+
 |18         | ShiftF6      | ESC[d    |
 +-----------+--------------+----------+
 |19         | ShiftF7      | ESC[e    |
 +-----------+--------------+----------+
 |20         | ShiftF8      | ESC[f    |
 +-----------+--------------+----------+
 |21         | ShiftF9      | ESC[g    |
 +-----------+--------------+----------+
 |22         | ShiftF10     | ESC[h    |
 +-----------+--------------+----------+
 |23         | ShiftF11     | ESC[i    |
 +-----------+--------------+----------+
 |24         | ShiftF12     | ESC[j    |
 +-----------+--------------+----------+
 |25         | CtrlF1       | ESC[k    |
 +-----------+--------------+----------+
 |26         | CtrlF2       | ESC[l    |
 +-----------+--------------+----------+
 |27         | CtrlF3       | ESC[m    |
 +-----------+--------------+----------+
 |28         | CtrlF4       | ESC[n    |
 +-----------+--------------+----------+
 |29         | CtrlF5       | ESC[o    |
 +-----------+--------------+----------+
 |30         | CtrlF6       | ESC[p    |
 +-----------+--------------+----------+
 |31         | CtrlF7       | ESC[q    |
 +-----------+--------------+----------+
 |32         | CtrlF8       | ESC[r    |
 +-----------+--------------+----------+
 |33         | CtrlF9       | ESC[s    |
 +-----------+--------------+----------+
 |34         | CtrlF10      | ESC[t    |
 +-----------+--------------+----------+
 |35         | CtrlF11      | ESC[u    |
 +-----------+--------------+----------+
 |36         | CtrlF12      | ESC[v    |
 +-----------+--------------+----------+
 |37         | CtrlShiftF1  | ESC[w    |
 +-----------+--------------+----------+
 |38         | CtrlShiftF2  | ESC[x    |
 +-----------+--------------+----------+
 |39         | CtrlShiftF3  | ESC[y    |
 +-----------+--------------+----------+
 |40         | CtrlShiftF4  | ESC[z    |
 +-----------+--------------+----------+
 |41         | CtrlShiftF5  | ESC[@    |
 +-----------+--------------+----------+
 |42         | CtrlShiftF6  | ESC[[    |
 +-----------+--------------+----------+
 |43         | CtrlShiftF7  | ESC[\    |
 +-----------+--------------+----------+
 |44         | CtrlShiftF8  | ESC[]    |
 +-----------+--------------+----------+
 |45         | CtrlShiftF9  | ESC[^    |
 +-----------+--------------+----------+
 |46         | CtrlShiftF10 | ESC[_    |
 +-----------+--------------+----------+
 |47         | CtrlShiftF11 | ESC[`    |
 +-----------+--------------+----------+
 |48         | CtrlShiftF12 | ESC[{    |
 +-----------+--------------+----------+
 |49         | Home         | ESC[H    |
 +-----------+--------------+----------+
 |50         |              | ESC[A    |
 +-----------+--------------+----------+
 |51         | PgUp         | ESC[I    |
 +-----------+--------------+----------+
 |52         | -            | -        |
 +-----------+--------------+----------+
 |53         |              | ESC[D    |
 +-----------+--------------+----------+
 |54         | 5            | ESC[E    |
 +-----------+--------------+----------+
 |55         |              | ESC[C    |
 +-----------+--------------+----------+
 |56         | +            | +        |
 +-----------+--------------+----------+
 |57         | End          | ESC[F    |
 +-----------+--------------+----------+
 |58         |              | ESC[B    |
 +-----------+--------------+----------+
 |59         | PgDn         | ESC[G    |
 +-----------+--------------+----------+
 |60         | Ins          | ESC[L    |
 +-----------+--------------+----------+

You can also map string keys using ioctl. The syntax is:
   #include <sys/keyboard.h>
   ioctl(fd,cmd,buf)
   int fd, cmd;
   char *buf;
   ...
Use this 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.

Diagnostics

The following error message may be displayed on the console. See messages(M) for general information about kernel error messages, including a list of generic device driver errors.
NOTICE: keyboard: AT mode reset to XT
The keyboard has been reset to XT mode by an ioctl call.

Files

/usr/lib/keyboard/keys
/usr/lib/keyboard/strings

See also

configure(ADM), kbmode(ADM), ioctl(S), mapchan(F), mapchan(M), mapkey(M), multiscreen(M), scancode(HW), screen(HW), setkey(C), stty(C), termio(M)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003