B. Appendix B — Console¶
The EFI console was designed to allow input from a wide variety of devices. This appendix provides examples of the mapping of keyboard input from various types of devices to EFI scan codes. While representative of common console devices in use today, it is not intended to be a comprehensive list. EFI application programmers can use this table to identify the EFI Scan Code generated by a specific key press. The description of the example device input data that generates a EFI Scan Code may be useful to EFI driver writers, as well as showing the limitations on which EFI Scan codes can be generated by different types of console input devices.
The EFI console was designed so that it could map to common console devices. This appendix explains how an EFI console could map to a VGA with PC AT 101/102, PC ANSI, or ANSI X3.64 consoles.
B.1. EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL¶
Tables EFI Scan Codes for EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI Scan Codes for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL give examples of how input from a set of common input devices is mapped to EFI scan codes. Terminals and terminal emulators generally report function and editing keys as escape or control sequences. These sequences are formed by a control character followed by one or more additional graphic characters that indicate what the sequence means. ANSI X3.64 terminals generally require an ANSI parser to determine how to interpret a sequence and how to determine that the sequence is complete. These terminals can generate sequences using either 8-bit controls or 7-bit control sequences. Older terminal types, such as the VT100+ have a simpler set of sequences that can be interpreted using simple case statements. These terminals usually generate only 7-bit data, and 7-bit control sequences.
In the tables below, the CSI character is the 8-bit control character 0x9B, and is equivalent to the 7-bit control sequence “ESC [” (the 0x1B control ESC followed by the left bracket character 0x5B). The sequences are shown with spaces for readability, but do not contain the space character.
The VT100+ column represents a common class of terminal emulation that is a superset of the Digital Equipment Corporation (DEC) VT100 terminal. This includes VT-UTF8 (Hyperterm) and PC_ANSI terminal types. The ANSI X3.64 column shows the sequences generated by the DEC VT200 through VT500 terminals, which are an ANSI X3.64 / ISO 6429 compliant.
The USB HID and AT 101/102 columns show the scan codes generated by two common directly attached keyboards. These keyboards are generally used in combination with a VGA text display to form a “VGA Console”.
In the table below, the cells with N/A contained in them are simply intended to reflect that the key may be defined for that terminal or keyboard, but there is no industry standard or consistent mapping for the key. Some input devices might not implement all of these keys.
EFI Scan Code |
Description |
ANSI X3.64 / DEC VT200-500 (8-bit mode) |
VT100+ (7-bit mode) |
USB Keyboard HID Values |
AT 101/102 Keyboard Scan Codes |
0x00 |
Null scan code |
N/A |
N/A |
0x00 |
N/A |
0x01 |
UP ARROW |
CSI A |
ESC [ A |
0x52 |
0xe0, 0x48 |
0x02 |
DOWN ARROW |
CSI B |
ESC [ B |
0x51 |
0xe0, 0x50 |
0x03 |
RIGHT ARROW |
CSI C |
ESC [ C |
0x4F |
0xe0, 0x4d |
0x04 |
LEFT ARROW |
CSI D |
ESC [ D |
0x50 |
0xe0, 0x4b |
0x05 |
Home |
CSI 1 ~ |
ESC h |
0x4A |
0xe0, 0x47 |
0x06 |
End |
CSI 4 ~ |
ESC k |
0x4D |
0xe0, 0x4f |
0x07 |
Insert |
CSI 2 ~ |
ESC + |
0x49 |
0xe0, 0x52 |
0x08 |
Delete |
CSI 3 ~ |
ESC - |
0x4C |
0xe0, 0x53 |
0x09 |
Page Up |
CSI 5 ~ |
ESC ? |
0x4B |
0xe0, 0x49 |
0x0a |
Page Down |
CSI 6 ~ |
ESC / |
0x4E |
0xe0, 0x51 |
0x0b |
Function 1 |
CSI 1 1 ~ |
ESC 1 |
0x3A |
0x3b |
0x0c |
Function 2 |
CSI 1 2 ~ |
ESC 2 |
0x3B |
0x3c |
0x0d |
Function 3 |
CSI 1 3 ~ |
ESC 3 |
0x3C |
0x3d |
0x0e |
Function 4 |
CSI 1 4 ~ |
ESC 4 |
0x3D |
0x3e |
0x0f |
Function 5 |
CSI 1 5 ~ |
ESC 5 |
0x3E |
0x3f |
0x10 |
Function 6 |
CSI 1 7 ~ |
ESC 6 |
0x3F |
0x40 |
0x11 |
Function 7 |
CSI 1 8 ~ |
ESC 7 |
0x40 |
0x41 |
0x12 |
Function 8 |
CSI 1 9 ~ |
ESC 8 |
0x41 |
0x42 |
0x13 |
Function 9 |
CSI 2 0 ~ |
ESC 9 |
0x42 |
0x43 |
0x14 |
Function 10 |
CSI 2 1 ~ |
ESC 0 |
0x43 |
0x44 |
0x17 |
Escape |
ESC |
ESC |
0x29 |
0x01 |
EFI Scan Code |
De scription |
ANSI X3.64 / DEC VT200-500 (8-bit mode) |
VT100+ (7-bit mode) |
USB Keyboard HID Values |
AT 101/102 Keyboard Scan Codes |
0x15 |
Function 11 |
CSI 2 3 ~ |
ESC ! |
0x44 |
0x57 |
0x16 |
Function 12 |
CSI 2 4 ~ |
ESC @ |
0x45 |
0x58 |
0x48 |
Pause |
N/A |
N/A |
0x48 |
0xe1, 0x1d, 0x45 |
0x68 |
Function 13 |
CSI 2 5 ~ |
N/A |
0x68 |
N/A |
0x69 |
Function 14 |
CSI 2 6 ~ |
N/A |
0x69 |
N/A |
0x6A |
Function 15 |
CSI 2 7 ~ |
N/A |
0x6A |
N/A |
0x6B |
Function 16 |
CSI 2 8 ~ |
N/A |
0x6B |
N/A |
0x6C |
Function 17 |
CSI 2 9 ~ |
N/A |
0x6C |
N/A |
0x6D |
Function 18 |
CSI 3 0 ~ |
N/A |
0x6D |
N/A |
0x6E |
Function 19 |
CSI 3 1 ~ |
N/A |
0x6E |
N/A |
0x6F |
Function 20 |
CSI 3 2 ~ |
N/A |
0x6F |
N/A |
0x70 |
Function 21 |
N/A |
N/A |
0x70 |
N/A |
0x71 |
Function 22 |
N/A |
N/A |
0x71 |
N/A |
0x72 |
Function 23 |
N/A |
N/A |
0x72 |
N/A |
0x73 |
Function 24 |
N/A |
N/A |
0x73 |
N/A |
0x7F |
Mute |
N/A |
N/A |
0x7F |
N/A |
0x80 |
Volume Up |
N/A |
N/A |
0x80 |
N/A |
0x81 |
Volume Down |
N/A |
N/A |
0x81 |
N/A |
0x100 |
B rightness Up |
N/A |
N/A |
N/A |
N/A |
0x101 |
B rightness Down |
N/A |
N/A |
N/A |
N/A |
0x102 |
Suspend |
N/A |
N/A |
N/A |
N/A |
0x103 |
Hibernate |
N/A |
N/A |
N/A |
N/A |
0x104 |
Toggle Display |
N/A |
N/A |
N/A |
N/A |
0x105 |
Recovery |
N/A |
N/A |
N/A |
N/A |
0x106 |
Eject |
N/A |
N/A |
N/A |
N/A |
0x80 00-0xFFFF |
OEM Reserved |
N/A |
N/A |
N/A |
N/A |
B.2. EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL for PC ANSI or ANSI X3.64 terminals¶
Table below defines how the programmatic methods of the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOs could be implemented as PC ANSI or ANSI X3.64 terminals. Detailed descriptions of PC ANSI and ANSI X3.64 escape sequences are as follows. The same type of operations can be supported via a PC AT type INT 10h interface.
PC ANSI Codes |
ANSI X3.64 Codes |
Description |
ESC [ 2 J |
CSI 2 J |
Clear Display Screen. |
ESC [ 0 m |
CSI 0 m |
Normal Text. |
ESC [ 1 m |
CSI 1 m |
Bright Text. |
ESC [ 7 m |
CSI 7 m |
Reversed Text. |
ESC [ 30 m |
CSI 30 m |
Black foreground, compliant with ISO Standard 6429. |
ESC [ 31 m |
CSI 31 m |
Red foreground, compliant with ISO Standard 6429. |
ESC [ 32 m |
CSI 32 m |
Green foreground, compliant with ISO Standard 6429. |
ESC [ 33 m |
CSI 33 m |
Yellow foreground, compliant with ISO Standard 6429. |
ESC [ 34 m |
CSI 34 m |
Blue foreground, compliant with ISO Standard 6429. |
ESC [ 35 m |
CSI 35 m |
Magenta foreground, compliant with ISO Standard 6429. |
ESC [ 36 m |
CSI 36 m |
Cyan foreground, compliant with ISO Standard 6429. |
ESC [ 37 m |
CSI 37 m |
White foreground, compliant with ISO Standard 6429. |
ESC [ 40 m |
CSI 40 m |
Black background, compliant with ISO Standard 6429. |
ESC [ 41 m |
CSI 41 m |
Red background, compliant with ISO Standard 6429. |
ESC [ 42 m |
CSI 42 m |
Green background, compliant with ISO Standard 6429. |
ESC [ 43 m |
CSI 43 m |
Yellow background, compliant with ISO Standard 6429. |
ESC [ 44 m |
CSI 44 m |
Blue background, compliant with ISO Standard 6429. |
ESC [ 45 m |
CSI 45 m |
Magenta background, compliant with ISO Standard 6429. |
ESC [ 46 m |
CSI 46 m |
Cyan background, compliant with ISO Standard 6429. |
ESC [ 47 m |
CSI 47 m |
White background, compliant with ISO Standard 6429. |
ESC [ = 3 h |
CSI = 3 h |
Set Mode 80x25 color. |
ESC [ row;col H |
CSI row;col H |
Set cursor position to row;col. Row and col are strings of ASCII digits. |
Usage |
EFI_KEY enum value |
USB Keyboard HID Values |
Typical AT-101 key position |
Key a and A |
EfiKeyC1 |
0x04 |
31 |
Key b and B |
EfiKeyB5 |
0x05 |
50 |
Key c and C |
EfiKeyB3 |
0x06 |
48 |
Key d and D |
EfiKeyC3 |
0x07 |
33 |
Key e and E |
EfiKeyD3 |
0x08 |
19 |
Key f and F |
EfiKeyC4 |
0x09 |
34 |
Key g and G |
EfiKeyC5 |
0x0A |
35 |
Key h and H |
EfiKeyC6 |
0x0B |
36 |
Key i and I |
EfiKeyD8 |
0x0C |
24 |
Key j and J |
EfiKeyC7 |
0x0D |
37 |
Key k and K |
EfiKeyC8 |
0x0E |
38 |
Key l and L |
EfiKeyC9 |
0x0F |
39 |
Key m and M |
EfiKeyB7 |
0x10 |
52 |
Key n and N |
EfiKeyB6 |
0x11 |
51 |
Key o and O |
EfiKeyD9 |
0x12 |
25 |
Key p and p |
EfiKeyD10 |
0x13 |
26 |
Key q and Q |
EfiKeyD1 |
0x14 |
17 |
Key r and R |
EfiKeyD4 |
0x15 |
20 |
Key s and S |
EfiKeyC2 |
0x16 |
32 |
Key t and T |
EfiKeyD5 |
0x17 |
21 |
Key u and U |
EfiKeyD7 |
0x18 |
23 |
Key v and V |
EfiKeyB4 |
0x19 |
49 |
Key w and W |
EfiKeyD2 |
0x1A |
18 |
Key x and X |
EfiKeyB2 |
0x1B |
47 |
Key y and Y |
EfiKeyD6 |
0x1C |
22 |
Key z and Z |
EfiKeyB1 |
0x1D |
46 |
Key 1 and ! |
EfiKeyE1 |
0x1E |
2 |
Key 2 and @ |
EfiKeyE2 |
0x1F |
3 |
Key 3 and # |
EfiKeyE3 |
0x20 |
4 |
Key 4 and $ |
EfiKeyE4 |
0x21 |
5 |
Key 5 and % |
EfiKeyE5 |
0x22 |
6 |
Key 6 and ^ |
EfiKeyE6 |
0x23 |
7 |
Key 7 and & |
EfiKeyE7 |
0x24 |
8 |
Key 8 and * |
EfiKeyE8 |
0x25 |
9 |
Key 9 and ( |
EfiKeyE9 |
0x26 |
10 |
Key 0 and ) |
EfiKeyE10 |
0x27 |
11 |
Enter* |
EfiKeyEnter |
0x28 |
43 |
Escape * |
EfiKeyEsc |
0x29 |
110 |
Del * / Backspace * |
EfiKeyBackSpace |
0x2A |
15 |
Tab * |
EfiKeyTab |
0x2B |
16 |
Spacebar |
EfiKeySpaceBar |
0x2C |
61 |
Key - and _ |
EfiKeySpaceBar |
0x2D |
12 |
Key = and + |
EfiKeySpaceBar |
0x2E |
13 |
Key [ and { |
EfiKeySpaceBar |
0x2F |
27 |
Key ] and } |
EfiKeyD12 |
0x30 |
28 |
Key and | |
EfiKeyD13 |
0x31 |
29 |
Key ; and : |
EfiKeyC10 |
0x33 |
40 |
Key ‘ and “ |
EfiKeyC11 |
0x34 |
41 |
Key ` and ~ |
EfiKeyE0 |
0x35 |
1 |
Key , and < |
EfiKeyB8 |
0x36 |
53 |
Key . and > |
EfiKeyB9 |
0x37 |
54 |
Key / and ? |
EfiKeyB10 |
0x38 |
55 |
Capslock * |
EfiKeyCapsLock |
0x39 |
30 |
F1* |
EfiKeyF1 |
0x3A |
112 |
F2* |
EfiKeyF2 |
0x3B |
113 |
F3* |
EfiKeyF3 |
0x3C |
114 |
F4* |
EfiKeyF4 |
0x3D |
115 |
F5* |
EfiKeyF5 |
0x3E |
116 |
F6* |
EfiKeyF6 |
0x3F |
117 |
F7* |
EfiKeyF7 |
0x40 |
118 |
F8* |
EfiKeyF8 |
0x41 |
119 |
F9* |
EfiKeyF9 |
0x42 |
120 |
F10* |
EfiKeyF10 |
0x43 |
121 |
F11* |
EfiKeyF11 |
0x44 |
122 |
F12* |
EfiKeyF12 |
0x45 |
123 |
PrintScreen* |
EfiKeyPrint |
0x46 |
124 |
ScrollLock* |
EfiKeySLck |
0x47 |
125 |
Pause* |
EfiKeyPause |
0x48 |
126 |
Insert* |
EfiKeyIns |
0x49 |
75 |
Home* |
EfiKeyHome |
0x4A |
80 |
PageUp* |
EfiKeyPgUp |
0x4B |
85 |
Delete* |
EfiKeyDel |
0x4C |
76 |
End* |
EfiKeyEnd |
0x4D |
81 |
PageDown* |
EfiKeyPgDn |
0x4E |
86 |
RightArrow* |
EfiKeyRightArrow |
0x4F |
89 |
LeftArrow* |
EfiKeyLeftArrow |
0x50 |
79 |
DownArrow* |
EfiKeyDownArrow |
0x51 |
84 |
UpArrow* |
EfiKeyUpArrow |
0x52 |
83 |
NumLock* |
EfiKeyNLck |
0x53 |
90 |
Keypad / |
EfiKeySlash |
0x54 |
95 |
Keypad * |
EfiKeyAsterisk |
0x55 |
100 |
Keypad - |
EfiKeyMinus |
0x56 |
105 |
Keypad + |
EfiKeyPlus |
0x57 |
106 |
Keypad Enter* |
EfiKeyEnter |
0x58 |
108 |
Keypad 1 and End* |
EfiKeyOne |
0x59 |
93 |
Keypad 2 and DownArrow* |
EfiKeyTwo |
0x5A |
98 |
Keypad 3 and |
EfiKeyThree PageDown* |
0x5B |
103 |
Keypad 4 and LeftArrow* |
EfiKeyFour |
0x5C |
92 |
Keypad 5 |
EfiKeyFive |
0x5D |
97 |
Keypad 6 and RightArrow * |
EfiKeySix |
0x5E |
102 |
Keypad 7 and Home * |
EfiKeySeven |
0x5F |
91 |
Keypad 8 and UpArrow* |
EfiKeyEight |
0x60 |
96 |
Keypad 9 and PageUp * |
EfiKeyNine |
0x61 |
101 |
Keypad 0 and Insert * |
EfiKeyZero |
0x62 |
99 |
Keypad . and Delete * |
EfiKeyPeriod |
0x63 |
104 |
Menu |
EfiKeyA4 |
0x76 |
n/a |
LeftControl* |
EfiKeyLCtrl |
0xE0 |
58 |
LeftShift* |
EfiKeyLShift |
0xE1 |
44 |
LeftAlt* |
EfiKeyLAlt |
0xE2 |
60 |
LeftLogo* |
EfiKeyA0 |
0xE3 |
127 |
RightControl* |
EfiKeyRCtrl |
0xE4 |
64 |
RightShift* |
EfiKeyRShift |
0xE5 |
57 |
RightAlt* |
EfiKeyA2 |
0xE6 |
62 |
RightLogo* |
EfiKeyA3 |
0xE7 |
128 |
Non-US # and ~ |
EfiKeyC12 |
0x32 |
42 |
Non-US and | |
EfiKeyIntl0 |
0x64 |
45 |
Non-US and _ |
EfiKeyIntl1 |
0x87 |
56 |
Non-US ¥ and | |
EfiKeyIntl3 |
0x89 |
n/a |
An * indicates a non-printable character or keyboard behavior