mapkey(7) mapkey(7)
NAME
mapkey - mechanism for PC terminals
DESCRIPTION
Keyboard mapping
The keyboard mapping structure is defined in /usr/include/sys/mapkey.h.
Each key can be in any of ten states. The first eight states are:
- BASE
- CTRL-SHIFT
- SHIFT
- ALT-SHIFT
- CTRL
- ALT-CTRL
- ALT
- ALT-CTRL-SHIFT
The other two states relate to two special bytes. The first byte
defines a special state. The bits in it indicate whether the key has
been identified as a special key in one or more of the first eight
states. The second byte consists of one of four possible codes, C, N,
B or O, indicating how the lock keys affect the key in question.
The table below describes the default keyboard mapping values. All
values other than special keywords (described further below) are ASCII
character values.
Column heading Description
SCAN CODE This column contains the scan code generated by the key-
board hardware when a key is pressed. The table does not
show the scan code generated when a key is released.
BASE This column shows the base value of a keystroke.
SHIFT This column shows the value of a keystroke when the key
is combined with SHIFT.
LOCK This column indicates the lock keys which affect the
key in question:
- C stands for CAPSLOCK
- N stands for NUMLOCK
- B stands for both
- O stands for lock function off
The other columns contain the values of keys pressed together with a
combination of the CTRL, ALT and SHIFT keys.
Page 1 Reliant UNIX 5.44 Printed 11/98
mapkey(7) mapkey(7)
_______________________________________________________________________________
| 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 nop esc nop esc O |
| 2 '1' '!' nop nop '1' '!' nop '!' O |
| 3 '2' '"' nop nop 0262 '"' nop '"' O |
| 4 '3' 0247 nop nop 0263 0247 nop 0247 O |
| 5 '4' '$' nop nop '4' '$' nop '$' O |
| 6 '5' '%' nop nop '5' '%' nop '%' O |
| 7 '6' '&' nop nop '6' '&' nop '&' O |
| 8 '7' '/' nop nop '{' '/' nop '/' O |
| 9 '8' '(' nop nop '[' '(' nop '(' O |
| 10 '9' ')' nop nop ']' ')' nop ')' O |
| 11 '0' '=' nop nop '}' '=' nop '=' O |
| 12 0337 '?' nop nop '\\' '?' nop 0034 O |
| 13 0264 '`' nop nop 0264 '`' nop '`' O |
| 14 bs bs del nop bs bs nop nop O |
| 15 ht fkey12 nop nop nop nop nop nop O |
| 16 'q' 'Q' dc1 dc1 '@' '@' nop 0x00 C |
| 17 'w' 'W' etb etb 'w' 'W' nop etb C |
| 18 'e' 'E' enq enq 'e' 'E' nop enq C |
| 19 'r' 'R' dc2 dc2 'r' 'R' nop dc2 C |
| 20 't' 'T' dc4 dc4 't' 'T' nop dc4 C |
| 21 'z' 'Z' em em 'z' 'Z' nop em C |
| 22 'u' 'U' nak nak 'u' 'U' nop nak C |
| 23 'i' 'I' ht ht 'i' 'I' nop ht C |
|_____________________________________________________________________________|
Page 2 Reliant UNIX 5.44 Printed 11/98
mapkey(7) mapkey(7)
_______________________________________________________________________________
| ALT |
|SCAN CTRL ALT ALT CTRL |
|CODE BASE SHIFT CTRL SHIFT ALT SHIFT CTRL SHIFT LOCK|
|_____________________________________________________________________________|
| 24 'o' 'O' si si 'o' 'O' nop si C |
| 25 'p' 'P' dle dle 'p' 'P' nop dle C |
| 26 0374 0334 nop nop 0374 0334 nop 0334 C |
| 27 '+' '*' nop nop '~' '*' nop '*' O |
| 28 cr cr nop nop cr cr nop cr O |
| 29 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O |
| 30 'a' 'A' soh soh 'a' 'A' nop soh C |
| 31 's' 'S' dc3 dc3 's' 'S' nop dc3 C |
| 32 'd' 'D' eot eot 't' 'T' nop eot C |
| 33 'f' 'F' ack ack 'f' 'F' nop ack C |
| 34 'g' 'G' bel bel 'g' 'G' nop bel C |
| 35 'h' 'H' bs bs 'h' 'H' nop bs C |
| 36 'j' 'J' nl nl 'j' 'J' nop nl C |
| 37 'k' 'K' vt vt 'k' 'K' nop vt C |
| 38 'l' 'L' np np 'l' 'L' nop np C |
| 39 0366 0326 nop nop 0366 0326 nop 0326 C |
| 40 0344 0304 nop nop 0344 0304 nop 0304 C |
| 41 '^' 0260 0036 0036 '^' 0230 nop 0036 O |
| 42 lshift lshift lshift lshift lshift lshift lshift lshift O |
| 43 '#' '\'' nop nop '#' '\'' nop '\'' O |
| 44 'y' 'Y' sub sub 'y' 'Y' nop sub C |
| 45 'x' 'X' can can 'x' 'X' nop can C |
| 46 'c' 'C' etx etx 'c' 'C' nop etx C |
| 47 'v' 'V' syn syn 'v' 'V' nop syn C |
| 48 'b' 'B' stx stx 'b' 'B' nop stx C |
| 49 'n' 'N' so so 'n' 'N' nop so C |
| 50 'm' 'M' cr cr 'm' 'M' nop cr C |
| 51 ',' ';' nop nop ',' ';' nop ';' O |
| 52 '.' ':' nop nop '.' ':' nop ':' O |
| 53 '-' '_' nop 0037 '-' '_' nop '_' O |
| 54 rshift rshift rshift rshift rshift rshift rshift rshift O |
| 55 '*' '*' nop nop '*' '*' nop nop O |
| 56 lalt lalt lalt lalt lalt lalt lalt lalt O |
| 57 ' ' ' ' nop nop ' ' ' ' nop ' ' O |
| 58 clock clock clock clock clock clock clock clock O |
| 59 fkey0 fkey12 fkey24 fkey36 nop nop nop nop O |
| 60 fkey1 fkey13 fkey25 fkey37 nop nop nop nop O |
| 61 fkey2 fkey14 fkey26 fkey38 nop nop nop nop O |
| 62 fkey3 fkey15 fkey27 fkey39 nop nop nop nop O |
| 63 fkey4 fkey16 fkey28 fkey40 nop nop nop nop O |
|_____________________________________________________________________________|
Page 3 Reliant UNIX 5.44 Printed 11/98
mapkey(7) mapkey(7)
________________________________________________________________________________
| ALT |
|SCAN CTRL ALT ALT CTRL |
|CODE BASE SHIFT CTRL SHIFT ALT SHIFT CTRL SHIFT LOCK|
|______________________________________________________________________________|
| 64 fkey5 fkey17 fkey29 fkey41 nop nop nop nop O |
| 65 fkey6 fkey18 fkey30 fkey42 nop nop nop nop O |
| 66 fkey7 fkey18 fkey31 fkey43 nop nop nop nop O |
| 67 fkey8 fkey20 fkey32 fkey44 nop nop nop nop O |
| 68 fkey9 fkey21 fkey33 fkey45 nop nop nop nop O |
| 69 nlock nlock nlock nlock nlock nlock nlock nlock O |
| 70 slock slock del nop slock slock nop nop O |
| 71 fkey48 '7' '7' '7' bel bel bel bel N |
| 72 fkey49 '8' '8' '8' 0x08 0x08 0x08 0x08 N |
| 73 fkey50 '9' '9' '9' 0x09 0x09 0x09 0x09 N |
| 74 fkey51 '-' nop nop '-' '-' nop '-' O |
| 75 fkey52 '4' '4' '4' 0x04 0x04 0x04 0x04 N |
| 76 fkey53 '5' '5' '5' 0x05 0x05 0x05 0x05 N |
| 77 fkey54 '6' '6' '6' 0x06 0x06 0x06 0x06 N |
| 78 fkey55 '+' nop nop '+' '+' nop '+' O |
| 79 fkey56 '1' '1' '1' 0x01 0x01 0x01 0x01 N |
| 80 fkey57 '2' '2' '2' 0x02 0x02 0x02 0x02 N |
| 81 fkey58 '3' '3' '3' 0x03 0x03 0x03 0x03 N |
| 82 fkey59 '0' '0' '0' 0x00 0x00 0x00 0x00 N |
| 83 del ',' ',' ',' ',' ',' nop ',' N |
| 84 nop nop nop nop nop nop nop nop O |
| 85 nop nop nop nop nop nop nop nop O |
| 86 '<' '>' nop nop '|' '>' nop '>' O |
| 87 fkey10 fkey22 fkey34 fkey46 nop nop nop nop O |
| 88 fkey11 fkey23 fkey35 fkey47 nop nop nop nop 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 nop nop nop nop nop nop nop nop O |
| 97 nop nop nop nop nop nop nop nop O |
| 98 nop nop nop nop nop nop nop nop O |
| 99 nop nop nop nop nop nop nop nop O |
|100 nop nop nop nop nop nop nop nop O |
|101 nop nop nop nop nop nop nop nop O |
|102 nop nop nop nop nop nop nop nop O |
|103 nop nop nop nop nop nop nop nop O |
|______________________________________________________________________________|
Page 4 Reliant UNIX 5.44 Printed 11/98
mapkey(7) mapkey(7)
_______________________________________________________________________________
| ALT |
|SCAN CTRL ALT ALT CTRL |
|CODE BASE SHIFT CTRL SHIFT ALT SHIFT CTRL SHIFT LOCK|
|_____________________________________________________________________________|
|104 nop nop nop nop nop nop nop nop O |
|105 nop nop nop nop nop nop nop nop O |
|106 nop nop nop nop nop nop nop nop 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 fkey59 fkey59 nop nop nop nop nop nop O |
|131 del del 0037 0037 del del nop 0037 O |
|132 fkey48 fkey48 nop nop nop nop nop nop O |
|133 fkey56 fkey56 nop nop nop nop nop nop O |
|134 fkey50 fkey50 nop nop nop nop nop nop O |
|135 fkey58 fkey58 nop nop nop nop nop nop O |
|136 fkey54 fkey54 nop nop nop nop nop nop O |
|137 fkey52 fkey52 nop nop nop nop nop nop O |
|138 fkey49 fkey49 nop nop nop nop nop nop O |
|139 fkey57 fkey57 nop nop nop nop nop nop O |
|140 '/' '/' nop nop '/' '/' nop '/' O |
|141 cr cr nop nop cr cr nop cr O |
|_____________________________________________________________________________|
Page 5 Reliant UNIX 5.44 Printed 11/98
mapkey(7) mapkey(7)
The next table lists the values of the special keywords used in the
previous table. These keywords were used above purely on grounds of
readability; in the actual keyboard mapping table a special keyword is
formed on the basis of its value and the corresponding bit in the
ninth state byte for a special state is set simultaneously.
______________________________________________________________________
| Name Value Function |
|_____________________________________________________________________|
| nop 0 No operation - the keystroke has no effect |
| lshift 2 left-hand SHIFT key |
| rshift 3 right-hand SHIFT key |
| clock 4 Caps lock (uppercase letters only) |
| nlock 5 Numeric lock (numeric values only) |
| slock 6 Scroll lock (scrolling on/off) |
| alt 7 ALT key |
| btab 8 Reset key - generates a fixed sequence (ESC[ Z) |
| ctrl 9 Control key |
| lalt 10 Left-hand ALT key |
| ralt 11 Right-hand ALT key |
| lctrl 12 Left-hand control key |
| rctrl 13 Right-hand control key |
| fkey1 27 Function key #1 |
| . . |
| . . |
| . . |
| fkey96 122 Function key #96 |
| sysreq 123 System request |
| brk 124 Break key |
| escn 125 Generate escape sequence ESC N x, where x is the value|
| of the scan code without the ALT key |
| esco 126 Generate escape sequence ESC O x, where x is the value|
| of the scan code without the ALT key |
| escl 127 Generate escape sequence ESC L x, where x is the value|
| of the scan code without the ALT key |
|_____________________________________________________________________|
Page 6 Reliant UNIX 5.44 Printed 11/98
mapkey(7) mapkey(7)
The next table lists the names and decimal values of the ASCII charac-
ters in the previous table. Numeric constants are replaced by names to
make the scan code table easier to read. Only the decimal values are
placed in the ioctl buffer. These values are taken from ascii(5).
___________________________________________________________
| Name Value| Name Value| Name Value| Name Value|
|_____________|______________|______________|______________|
| nul 0 | ht 9 | dc2 18 | esc 27 |
| soh 1 | nl 10 | dc3 19 | fs 28 |
| stx 2 | vt 11 | dc4 20 | gs 29 |
| etx 3 | np 12 | nak 21 | rs 30 |
| eot 4 | cr 13 | syn 22 | ns 31 |
| enq 5 | so 14 | etb 23 | del 127 |
| ack 6 | si 15 | can 24 | |
| bel 7 | dle 16 | em 25 | |
| bs 8 | dc1 17 | sub 26 | |
|_____________|______________|______________|______________|
Function key assignments
The string mapping table is a 512-byte area (typedef strmapt). This
area contains null-terminated strings which redefine function keys.
The first null-terminated string is assigned to the first function
key, the second string to the second function key, and so on.
There is no restriction on the length of a given string as long as the
whole table, including the nulls, is no more than 512 bytes long. To
set a string to null, extra null characters are added. The following
table illustrates the default function key assignments.
Page 7 Reliant UNIX 5.44 Printed 11/98
mapkey(7) mapkey(7)
String key values
____________________________________
| "\033[M" Function #1 |
| "\033[N" Function #2 |
| "\033[O" Function #3 |
| "\033[P" Function #4 |
| "\033[Q" Function #5 |
| "\033[R" Function #6 |
| "\033[S" Function #7 |
| "\033[T" Function #8 |
| "\033[U" Function #9 |
| "\033[V" Function #10 |
| "\033[W" Function #11 |
| "\033[X" Function #12 |
| "\033[Y" Shift Function #1 |
| "\033[Z" Shift Function #2 |
| "\033[a" Shift Function #3 |
| "\033[b" Shift Function #4 |
| "\033[c" Shift Function #5 |
| "\033[d" Shift Function #6 |
| "\033[e" Shift Function #7 |
| "\033[f" Shift Function #8 |
| "\033[g" Shift Function #9 |
| "\033[h" Shift Function #10 |
| "\033[i" Shift Function #11 |
| "\033[j" Shift Function #12 |
| "\033[k" Control Function #1 |
| "\033[l" Control Function #2 |
| "\033[m" Control Function #3 |
| "\033[n" Control Function #4 |
| "\033[o" Control Function #5 |
| "\033[p" Control Function #6 |
|___________________________________|
Page 8 Reliant UNIX 5.44 Printed 11/98
mapkey(7) mapkey(7)
____________________________________
| "\033[q" Control Function #7 |
| "\033[r" Control Function #8 |
| "\033[s" Control Function #9 |
| "\033[t" Control Function #10 |
| "\033[u" Control Function #11 |
| "\033[v" Control Function #12 |
| "\033[w" Ctrl/Shft Function #1 |
| "\033[x" Ctrl/Shft Function #2 |
| "\033[y" Ctrl/Shft Function #3 |
| "\033[z" Ctrl/Shft Function #4 |
| "\033[@" Ctrl/Shft Function #5 |
| "\033[[" Ctrl/Shft Function #6 |
| "\033[\" Ctrl/Shft Function #7 |
| "\033[]" Ctrl/Shft Function #8 |
| "\033[^" Ctrl/Shft Function #9 |
| "\033[" Ctrl/Shft Function #10 |
| "\033[`" Ctrl/Shft Function #11 |
| "\033[{" Ctrl/Shft Function #12 |
| "\033[H" Home |
| "\033[A" Up arrow |
| "\033[I" Page up |
| "-" - |
| "\033[D" Left arrow |
| "\033[E" 5 |
| "\033[C" Right arrow |
| "+" + |
| "\033[F" End |
| "\033[B" Down arrow |
| "\033[G" Page down |
| "\033[L" Insert |
|___________________________________|
ioctl calls
KDGKBMODE
This call checks the current keyboard mode. It returns one of the
following values as defined in /usr/include/sys/mapkey.h:
#define KRAW 0x00 /* send scan code for line */
#define KXLATE 0x01 /* translate to ASCII */
A pointer to a variable in which the value is to be stored must
be passed.
KDSKBMODE
This call sets the current keyboard mode. The call argument is
either KRAW or KXLATE. In raw mode the program can read the raw
up/down scan codes from the keyboard. In translation mode the
translation tables are used to generate the appropriate scan
code.
Page 9 Reliant UNIX 5.44 Printed 11/98
mapkey(7) mapkey(7)
KDGKBENT
This call reads one of the entries from the translation table.
The call argument is the address of one of the following struc-
tures as defined in /usr/include/mapkey/kd.h. The first two
fields are filled.
struct kbentry {
unchar kbtable; /* table to read */
unchar kbindex; /* entry in table */
ushort kbvalue; /* value to read/set */
};
The following are the allowable values for kbtable:
#define KNORMTAB 0x00 /* BASE */
#define KSHIFTTAB 0x01 /* SHIFT */
#define KALTTAB 0x02 /* ALT */
#define KALTSHIFTTAB 0X03 /* SHIFT ALT */
This ioctl fetches the specified entry from the translation table
and returns it in the third field.
KDSKBENT
This call sets an entry in one of the translation tables. It uses
the same structure as the KDGKBENT ioctl, with the third field
being supplied with the value which is to be entered in the
translation table. This is a way of fully or partly readdressing
the keyboard.
GIOKEYMAP
This call fetches the entire keyboard mapping table from the ker-
nel. The structure of the argument is defined in
/usr/include/sys/mapkey.h.
PIOKEYMAP
This call sets the entire keyboard mapping table. The structure
of the argument is defined in /usr/include/sys/mapkey.h.
GIOSTRMAP
This call fetches the string mapping table from the kernel. The
structure of the argument is defined in
/usr/include/sys/mapkey.h.
PIOSTRMAP
This call sets the string mapping table. The structure of the
argument is defined in /usr/include/sys/mapkey.h.
Page 10 Reliant UNIX 5.44 Printed 11/98
mapkey(7) mapkey(7)
GETFKEY
Fetches the current definition of a function key. The argument
for this call is the address of one of the following structures
as defined in /usr/include/sys/mapkey.h:
struct fkeyarg {
unsigned int keynum;
char keydef [MAXFK]; /* via comcrt.h from ioctl.h */
char flen;
};
The function key number must be passed in keynum (see arg struc-
ture above). After execution of the ioctl, the key sequence
currently assigned to the key is returned in keydef, and the
length of the sequence is returned in flen.
SETFKEY
Assigns a function key to a given key sequence. The call uses the
same structure as the GETFKEY ioctl. The number of the function
key must be passed in keynum, the key sequence in keydef, and the
length of the key sequence (number of characters) in flen.
FILES
/usr/lib/keyboard/*
SEE ALSO
mapkey(1M).
Page 11 Reliant UNIX 5.44 Printed 11/98