x86
SUNWcsu
To be able to use characters from the French, German, Finnish, and other alphabets, there are systems available on the market that generate 7-bit codes but display the above-mentioned characters on the screen instead of the ones found on a U.S. console. On the keyboard there are an equal number of keys, but there are different characters on the key caps. Others may support 256 different characters at a time but use their own proprietary codesets.
For example, if you are using the Solaris for x86 system with
a console and a French keyboard and you do not use pcmapkeys to map the
French keyboard tables, then if you edit a file and use the French character
o"e’" in text, the actual code generated is ASCII 123, which is the code
normally used for the left curly brace. If you look at the edited file on
the console, the letter will actually appear to be a curly brace. Using
pcmapkeys to map in the French keyboard allows consistent input and output
mappings.
Function keys
Up to 60 key combinations are recognized as function keys. The first 12
are the 12 function keys of a 101-key PC-keyboard (the first 10 on an 84-key
keyboard).
If you do not know whether you have an 84- or 101-key keyboard, you can use the following scheme to determine which type you have:
F13 to F24 are the same keys used in combination with Shift, F25 to F36
when used with Ctrl, and F37 to F48 when used with Ctrl and Shift together.
F49 to F60 are the keys on the numeric keypad, in the following order:
Regular
keys
Scancodes generated by all keys on the PC keyboard can be translated in
a different way as well. For each key, a different translation can be specified
for each of the following four cases:
1. The key is pressed.
2. The key and the Shift key are pressed simultaneously.
3. The key and the Alt key are pressed simultaneously.
4. The key, the Shift, and the Alt keys are pressed simultaneously.
For each of these cases, the scancode can be translated into one of the following:
Internally, special bits are set to indicate that an escape sequence needs to be generated. Other bits are used to indicate whether the translated code should be influenced by some special keys.
A mapfile is a text file that consists of several sections. A sharp sign (#) can be used to include comments. Everything following the # until the end of the line will be ignored by the pcmapkeys program. Inside a line, C-style comments can be used as well. The beginning of each section is indicated by a keyword. Spaces and tabs are silently ignored and can be used at all times to improve readability. All but one section, the one that defines the compose character, can be left out. The order in which the different sections should appear is predefined. Here is the list of keywords in the order they should appear:
Characters can be described in several different ways. ASCII
characters can be described by putting them between single quotes. For example:
Between single quotes, control characters can be listed by using
a circumflex sign before the character that needs to be quoted. For example:
When a backslash (\) is used, what follows will be interpreted as a decimal,
octal (leading zero), or hexadecimal (leading x or X) representation of
the character, although in this case the use of single quotes is not mandatory.
For example:
is the same as:
and:
is the same as:
When strings are needed, a list of character representations should be used. Quoted strings will be supported in the future.
The following paragraphs describe what goes in each section.
Input section
The input section describes which input characters should be mapped into
a single byte. A very small sample input section could be:
input:
Toggle
section
The toggle section is a one-line section that defines which key is to toggle
between mapping and no mapping. For example:
toggle:
Deadkey section
The deadkey section defines which keys should be treated as deadkeys. A
dead: keyword followed by the specification of the character appears in
this section for each deadkey. The subsequent lines describe what key should
be generated for each key following the deadkey. A deadkey followed by a
key not described in this part of the mapfile will not generate any key
and a beep tone will be produced on the terminal. For example:
dead: ’^’ # circumflex is a deadkey dead: ’"’ # double quote used as a deadkey
Compose section
The first line of this section describes what the compose character is.
That line should always be present in the mapfile. Subsequent lines consist
of three character representations indicating each time that the third
character needs to be generated on input when the compose character is
followed by the first two. Compose sequences with the same first character
should be grouped together. For example:
compose: ’^x’
The following example would give the wrong result. All lines starting with the same character specification should be grouped together.
compose: ’^x’
Output section
This section describes the mapping on output, either single byte to single
byte, or single byte to string. A string is specified as a series of character
specifications. For example:
output:
0x82 ’{’ # map e with accent to { to display e with accent
Scancodes section
This section will only have an effect when your terminal is a scancode
device. No error message will be produced if this section is in your mapfile
when not needed, because the pcmapkeys program will find out whether the
terminal is a scancode device or not. The lines in this section can have
two different formats. One format will be used to describe what the values
of the function keys must be. The other format describes the translation
of scancodes into a byte or an escape sequence. No specific order is required.
Function keys
Here is an example of a line defining a string for a function key:
F13 ’d’’a’’t’’e’’\n’ # Shift F1 is the date command
The numbering convention of the function keys is described in a previous section. Currently, the use of quoted strings such as "date\n" is not supported.
Scancodes
Specifying how to translate a scancode is a more complex task. The general
format of such a line is:
scancode normal shift alt shiftalt flags
scancode should list the hexadecimal representation of a scancode generated by a key (unquoted). How keys correspond with scancodes can be found in keyboard(7D) .
normal, shift, alt and shiftalt are character representations in one of the formats described throughout this document, optionally followed by one of the following special keywords:
|C This indicates that the key is influenced by the Ctrl key.
|N This indicates that Esc N should preceed the specified character.
|O This indicates that Esc O should preceed the specified character.
|[ This indicates that Esc [ should preceed the specified character.
The normal field defines how the scancode is translated when no other key is pressed, the shift field defines the translation for when the Shift key is used simultaneously, the alt field specifies what to do when the Alt key is pressed together with this and the shiftalt field contains the information on what to generate when both the Shift and Alt keys are pressed.
All five fields must be filled in. When no translation is requested (that is, the current active translation does not need to be changed) a dash (-) can be used. The sixth field is optional. This field can contain the special keyword CAPS or NUM or both, to indicate whether or not the Caps Lock key or Num Lock key status have any effect. Here is a sample line that describes the default translation for the ’Q’ key:
0x10 ’q’|C ’Q’|C ’q’|N ’Q’|N CAPS
If the normal or shift field is filled out for a scancode that represents
a function key, a self-explanatory message will be produced and that translation
information will be ignored.
A more detailed example of a scancodes section is:
scancodes:
# the w key
0x11 ’w’|C ’W’|C ’w’|N ’W’|N CAPS
# left square bracket and curly brace key
# control shift [ does not generate anything (no C flag)
0x1a ’[’|C ’{’ ’[’|N ’{’|N
# 9 on numeric keypad
0x49 ’V’|[ ’9’ ’9’|N ’9’|N NUM
F13 ’d’’a’’t’’e’’0 # SHIFT
F1
More complete examples of mapfiles can be found in the /usr/share/lib/keyboards directory.