MdeModulePkg/TerminalDxe: Extend the terminal console support types

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2186

Extend the support types of terminal console driver. New added types
are Linux, XtermR6, VT400 and SCO.

Refer to
https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-funkeys

Add the missing VT100+ function keys map.

Add F1-F12 function keys map for Linux, XtermR6, VT400 and SCO.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Zhichao Gao 2019-09-06 15:38:00 +08:00 committed by Liming Gao
parent da63ba5174
commit 8a53ea9d9f
5 changed files with 320 additions and 26 deletions

View File

@ -2,7 +2,7 @@
Produces Simple Text Input Protocol, Simple Text Input Extended Protocol and Produces Simple Text Input Protocol, Simple Text Input Extended Protocol and
Simple Text Output Protocol upon Serial IO Protocol. Simple Text Output Protocol upon Serial IO Protocol.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -28,7 +28,11 @@ EFI_GUID *mTerminalType[] = {
&gEfiVT100Guid, &gEfiVT100Guid,
&gEfiVT100PlusGuid, &gEfiVT100PlusGuid,
&gEfiVTUTF8Guid, &gEfiVTUTF8Guid,
&gEfiTtyTermGuid &gEfiTtyTermGuid,
&gEdkiiLinuxTermGuid,
&gEdkiiXtermR6Guid,
&gEdkiiVT400Guid,
&gEdkiiSCOTermGuid
}; };
@ -37,7 +41,11 @@ CHAR16 *mSerialConsoleNames[] = {
L"VT-100 Serial Console", L"VT-100 Serial Console",
L"VT-100+ Serial Console", L"VT-100+ Serial Console",
L"VT-UTF8 Serial Console", L"VT-UTF8 Serial Console",
L"Tty Terminal Serial Console" L"Tty Terminal Serial Console",
L"Linux Terminal Serial Console",
L"Xterm R6 Serial Console",
L"VT-400 Serial Console",
L"SCO Terminal Serial Console"
}; };
TERMINAL_DEV mTerminalDevTemplate = { TERMINAL_DEV mTerminalDevTemplate = {
@ -187,7 +195,8 @@ TerminalDriverBindingSupported (
} }
// //
// only supports PC ANSI, VT100, VT100+, VT-UTF8, and TtyTerm terminal types // only supports PC ANSI, VT100, VT100+, VT-UTF8, TtyTerm
// Linux, XtermR6, VT400 and SCO terminal types
// //
if (TerminalTypeFromGuid (&Node->Guid) == ARRAY_SIZE (mTerminalType)) { if (TerminalTypeFromGuid (&Node->Guid) == ARRAY_SIZE (mTerminalType)) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;

View File

@ -1,7 +1,7 @@
/** @file /** @file
Header file for Terminal driver. Header file for Terminal driver.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.<BR> Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
@ -81,7 +81,11 @@ typedef enum {
TerminalTypeVt100, TerminalTypeVt100,
TerminalTypeVt100Plus, TerminalTypeVt100Plus,
TerminalTypeVtUtf8, TerminalTypeVtUtf8,
TerminalTypeTtyTerm TerminalTypeTtyTerm,
TerminalTypeLinux,
TerminalTypeXtermR6,
TerminalTypeVt400,
TerminalTypeSCO
} TERMINAL_TYPE; } TERMINAL_TYPE;
typedef struct { typedef struct {
@ -126,7 +130,9 @@ typedef struct {
#define INPUT_STATE_LEFTOPENBRACKET 0x04 #define INPUT_STATE_LEFTOPENBRACKET 0x04
#define INPUT_STATE_O 0x08 #define INPUT_STATE_O 0x08
#define INPUT_STATE_2 0x10 #define INPUT_STATE_2 0x10
#define INPUT_STATE_LEFTOPENBRACKET_2 0x20 #define INPUT_STATE_LEFTOPENBRACKET_TTY 0x20
#define INPUT_STATE_1 0x40
#define INPUT_STATE_LEFTOPENBRACKET_2ND 0x80
#define RESET_STATE_DEFAULT 0x00 #define RESET_STATE_DEFAULT 0x00
#define RESET_STATE_ESC_R 0x01 #define RESET_STATE_ESC_R 0x01
@ -848,7 +854,8 @@ TerminalRemoveConsoleDevVariable (
/** /**
Build termial device path according to terminal type. Build termial device path according to terminal type.
@param TerminalType The terminal type is PC ANSI, VT100, VT100+ or VT-UTF8. @param TerminalType The terminal type is PC ANSI, VT100, VT100+, VT-UTF8, TTY-Term,
Linux, XtermR6, VT400 and SCO.
@param ParentDevicePath Parent device path. @param ParentDevicePath Parent device path.
@param TerminalDevicePath Returned terminal device path, if building successfully. @param TerminalDevicePath Returned terminal device path, if building successfully.
@ -1209,6 +1216,28 @@ AnsiRawDataToUnicode (
| F12 | 0x16 | | ESC @ | | | F12 | 0x16 | | ESC @ | |
+=========+======+===========+==========+==========+ +=========+======+===========+==========+==========+
Putty function key map:
+=========+======+===========+=============+=============+=============+=========+
| | EFI | | | | | |
| | Scan | | | Normal | | |
| KEY | Code | VT100+ | Xterm R6 | VT400 | Linux | SCO |
+=========+======+===========+=============+=============+=============+=========+
| F1 | 0x0B | ESC O P | ESC O P | ESC [ 1 1 ~ | ESC [ [ A | ESC [ M |
| F2 | 0x0C | ESC O Q | ESC O Q | ESC [ 1 2 ~ | ESC [ [ B | ESC [ N |
| F3 | 0x0D | ESC O R | ESC O R | ESC [ 1 3 ~ | ESC [ [ C | ESC [ O |
| F4 | 0x0E | ESC O S | ESC O S | ESC [ 1 4 ~ | ESC [ [ D | ESC [ P |
| F5 | 0x0F | ESC O T | ESC [ 1 5 ~ | ESC [ 1 5 ~ | ESC [ [ E | ESC [ Q |
| F6 | 0x10 | ESC O U | ESC [ 1 7 ~ | ESC [ 1 7 ~ | ESC [ 1 7 ~ | ESC [ R |
| F7 | 0x11 | ESC O V | ESC [ 1 8 ~ | ESC [ 1 8 ~ | ESC [ 1 8 ~ | ESC [ S |
| F8 | 0x12 | ESC O W | ESC [ 1 9 ~ | ESC [ 1 9 ~ | ESC [ 1 9 ~ | ESC [ T |
| F9 | 0x13 | ESC O X | ESC [ 2 0 ~ | ESC [ 2 0 ~ | ESC [ 2 0 ~ | ESC [ U |
| F10 | 0x14 | ESC O Y | ESC [ 2 1 ~ | ESC [ 2 1 ~ | ESC [ 2 1 ~ | ESC [ V |
| Escape | 0x17 | ESC | ESC | ESC | ESC | ESC |
| F11 | 0x15 | ESC O Z | ESC [ 2 3 ~ | ESC [ 2 3 ~ | ESC [ 2 3 ~ | ESC [ W |
| F12 | 0x16 | ESC O [ | ESC [ 2 4 ~ | ESC [ 2 4 ~ | ESC [ 2 4 ~ | ESC [ X |
+=========+======+===========+=============+=============+=============+=========+
Special Mappings Special Mappings
================ ================
ESC R ESC r ESC R = Reset System ESC R ESC r ESC R = Reset System

View File

@ -2,7 +2,7 @@
Implementation for EFI_SIMPLE_TEXT_INPUT_PROTOCOL protocol. Implementation for EFI_SIMPLE_TEXT_INPUT_PROTOCOL protocol.
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR> (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.<BR> Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
@ -453,6 +453,10 @@ TranslateRawDataToEfiKey (
case TerminalTypeVt100: case TerminalTypeVt100:
case TerminalTypeVt100Plus: case TerminalTypeVt100Plus:
case TerminalTypeTtyTerm: case TerminalTypeTtyTerm:
case TerminalTypeLinux:
case TerminalTypeXtermR6:
case TerminalTypeVt400:
case TerminalTypeSCO:
AnsiRawDataToUnicode (TerminalDevice); AnsiRawDataToUnicode (TerminalDevice);
UnicodeToEfiKey (TerminalDevice); UnicodeToEfiKey (TerminalDevice);
break; break;
@ -1319,6 +1323,27 @@ UnicodeToEfiKeyFlushState (
| F12 | 0x16 | | ESC @ | | | F12 | 0x16 | | ESC @ | |
+=========+======+===========+==========+==========+ +=========+======+===========+==========+==========+
Putty function key map:
+=========+======+===========+=============+=============+=============+=========+
| | EFI | | | | | |
| | Scan | | | Normal | | |
| KEY | Code | VT100+ | Xterm R6 | VT400 | Linux | SCO |
+=========+======+===========+=============+=============+=============+=========+
| F1 | 0x0B | ESC O P | ESC O P | ESC [ 1 1 ~ | ESC [ [ A | ESC [ M |
| F2 | 0x0C | ESC O Q | ESC O Q | ESC [ 1 2 ~ | ESC [ [ B | ESC [ N |
| F3 | 0x0D | ESC O R | ESC O R | ESC [ 1 3 ~ | ESC [ [ C | ESC [ O |
| F4 | 0x0E | ESC O S | ESC O S | ESC [ 1 4 ~ | ESC [ [ D | ESC [ P |
| F5 | 0x0F | ESC O T | ESC [ 1 5 ~ | ESC [ 1 5 ~ | ESC [ [ E | ESC [ Q |
| F6 | 0x10 | ESC O U | ESC [ 1 7 ~ | ESC [ 1 7 ~ | ESC [ 1 7 ~ | ESC [ R |
| F7 | 0x11 | ESC O V | ESC [ 1 8 ~ | ESC [ 1 8 ~ | ESC [ 1 8 ~ | ESC [ S |
| F8 | 0x12 | ESC O W | ESC [ 1 9 ~ | ESC [ 1 9 ~ | ESC [ 1 9 ~ | ESC [ T |
| F9 | 0x13 | ESC O X | ESC [ 2 0 ~ | ESC [ 2 0 ~ | ESC [ 2 0 ~ | ESC [ U |
| F10 | 0x14 | ESC O Y | ESC [ 2 1 ~ | ESC [ 2 1 ~ | ESC [ 2 1 ~ | ESC [ V |
| Escape | 0x17 | ESC | ESC | ESC | ESC | ESC |
| F11 | 0x15 | ESC O Z | ESC [ 2 3 ~ | ESC [ 2 3 ~ | ESC [ 2 3 ~ | ESC [ W |
| F12 | 0x16 | ESC O [ | ESC [ 2 4 ~ | ESC [ 2 4 ~ | ESC [ 2 4 ~ | ESC [ X |
+=========+======+===========+=============+=============+=============+=========+
Special Mappings Special Mappings
================ ================
ESC R ESC r ESC R = Reset System ESC R ESC r ESC R = Reset System
@ -1378,7 +1403,9 @@ UnicodeToEfiKey (
} }
if (UnicodeChar == 'O' && (TerminalDevice->TerminalType == TerminalTypeVt100 || if (UnicodeChar == 'O' && (TerminalDevice->TerminalType == TerminalTypeVt100 ||
TerminalDevice->TerminalType == TerminalTypeTtyTerm)) { TerminalDevice->TerminalType == TerminalTypeTtyTerm ||
TerminalDevice->TerminalType == TerminalTypeXtermR6 ||
TerminalDevice->TerminalType == TerminalTypeVt100Plus)) {
TerminalDevice->InputState |= INPUT_STATE_O; TerminalDevice->InputState |= INPUT_STATE_O;
TerminalDevice->ResetState = RESET_STATE_DEFAULT; TerminalDevice->ResetState = RESET_STATE_DEFAULT;
continue; continue;
@ -1548,6 +1575,60 @@ UnicodeToEfiKey (
Key.ScanCode = SCAN_END; Key.ScanCode = SCAN_END;
break; break;
} }
} else if (TerminalDevice->TerminalType == TerminalTypeVt100Plus) {
switch (UnicodeChar) {
case 'P':
Key.ScanCode = SCAN_F1;
break;
case 'Q':
Key.ScanCode = SCAN_F2;
break;
case 'R':
Key.ScanCode = SCAN_F3;
break;
case 'S':
Key.ScanCode = SCAN_F4;
break;
case 'T':
Key.ScanCode = SCAN_F5;
break;
case 'U':
Key.ScanCode = SCAN_F6;
break;
case 'V':
Key.ScanCode = SCAN_F7;
break;
case 'W':
Key.ScanCode = SCAN_F8;
break;
case 'X':
Key.ScanCode = SCAN_F9;
break;
case 'Y':
Key.ScanCode = SCAN_F10;
break;
case 'Z':
Key.ScanCode = SCAN_F11;
break;
case '[':
Key.ScanCode = SCAN_F12;
break;
}
} else if (TerminalDevice->TerminalType == TerminalTypeXtermR6) {
switch (UnicodeChar) {
case 'P':
Key.ScanCode = SCAN_F1;
break;
case 'Q':
Key.ScanCode = SCAN_F2;
break;
case 'R':
Key.ScanCode = SCAN_F3;
break;
case 'S':
Key.ScanCode = SCAN_F4;
break;
}
} }
if (Key.ScanCode != SCAN_NULL) { if (Key.ScanCode != SCAN_NULL) {
@ -1564,15 +1645,34 @@ UnicodeToEfiKey (
case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET: case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET:
if (UnicodeChar == '1' && (TerminalDevice->TerminalType == TerminalTypeXtermR6 ||
TerminalDevice->TerminalType == TerminalTypeVt400 ||
TerminalDevice->TerminalType == TerminalTypeLinux)) {
TerminalDevice->InputState |= INPUT_STATE_1;
continue;
}
if (UnicodeChar == '2' && (TerminalDevice->TerminalType == TerminalTypeXtermR6 ||
TerminalDevice->TerminalType == TerminalTypeVt400 ||
TerminalDevice->TerminalType == TerminalTypeLinux)) {
TerminalDevice->InputState |= INPUT_STATE_2;
continue;
}
if (UnicodeChar == LEFTOPENBRACKET && TerminalDevice->TerminalType == TerminalTypeLinux) {
TerminalDevice->InputState |= INPUT_STATE_LEFTOPENBRACKET_2ND;
continue;
}
TerminalDevice->ResetState = RESET_STATE_DEFAULT; TerminalDevice->ResetState = RESET_STATE_DEFAULT;
Key.ScanCode = SCAN_NULL; Key.ScanCode = SCAN_NULL;
if (TerminalDevice->TerminalType == TerminalTypePcAnsi || if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
TerminalDevice->TerminalType == TerminalTypeVt100 || TerminalDevice->TerminalType == TerminalTypeVt100 ||
TerminalDevice->TerminalType == TerminalTypeVt100Plus ||
TerminalDevice->TerminalType == TerminalTypeVtUtf8 || TerminalDevice->TerminalType == TerminalTypeVtUtf8 ||
TerminalDevice->TerminalType == TerminalTypeTtyTerm) { TerminalDevice->TerminalType == TerminalTypeTtyTerm ||
TerminalDevice->TerminalType == TerminalTypeSCO) {
switch (UnicodeChar) { switch (UnicodeChar) {
case 'A': case 'A':
Key.ScanCode = SCAN_UP; Key.ScanCode = SCAN_UP;
@ -1614,12 +1714,15 @@ UnicodeToEfiKey (
case 'X': case 'X':
if (TerminalDevice->TerminalType == TerminalTypePcAnsi) { if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
Key.ScanCode = SCAN_DELETE; Key.ScanCode = SCAN_DELETE;
} else if (TerminalDevice->TerminalType == TerminalTypeSCO) {
Key.ScanCode = SCAN_F12;
} }
break; break;
case 'P': case 'P':
if (TerminalDevice->TerminalType == TerminalTypeVt100) { if (TerminalDevice->TerminalType == TerminalTypeVt100) {
Key.ScanCode = SCAN_DELETE; Key.ScanCode = SCAN_DELETE;
} else if (TerminalDevice->TerminalType == TerminalTypePcAnsi) { } else if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
TerminalDevice->TerminalType == TerminalTypeSCO) {
Key.ScanCode = SCAN_F4; Key.ScanCode = SCAN_F4;
} }
break; break;
@ -1629,7 +1732,8 @@ UnicodeToEfiKey (
} }
break; break;
case 'V': case 'V':
if (TerminalDevice->TerminalType == TerminalTypePcAnsi) { if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
TerminalDevice->TerminalType == TerminalTypeSCO) {
Key.ScanCode = SCAN_F10; Key.ScanCode = SCAN_F10;
} }
break; break;
@ -1644,7 +1748,8 @@ UnicodeToEfiKey (
} }
break; break;
case 'U': case 'U':
if (TerminalDevice->TerminalType == TerminalTypePcAnsi) { if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
TerminalDevice->TerminalType == TerminalTypeSCO) {
Key.ScanCode = SCAN_F9; Key.ScanCode = SCAN_F9;
} }
break; break;
@ -1654,40 +1759,52 @@ UnicodeToEfiKey (
} }
break; break;
case 'M': case 'M':
if (TerminalDevice->TerminalType == TerminalTypePcAnsi) { if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
TerminalDevice->TerminalType == TerminalTypeSCO) {
Key.ScanCode = SCAN_F1; Key.ScanCode = SCAN_F1;
} }
break; break;
case 'N': case 'N':
if (TerminalDevice->TerminalType == TerminalTypePcAnsi) { if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
TerminalDevice->TerminalType == TerminalTypeSCO) {
Key.ScanCode = SCAN_F2; Key.ScanCode = SCAN_F2;
} }
break; break;
case 'O': case 'O':
if (TerminalDevice->TerminalType == TerminalTypePcAnsi) { if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
TerminalDevice->TerminalType == TerminalTypeSCO) {
Key.ScanCode = SCAN_F3; Key.ScanCode = SCAN_F3;
} }
break; break;
case 'Q': case 'Q':
if (TerminalDevice->TerminalType == TerminalTypePcAnsi) { if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
TerminalDevice->TerminalType == TerminalTypeSCO) {
Key.ScanCode = SCAN_F5; Key.ScanCode = SCAN_F5;
} }
break; break;
case 'R': case 'R':
if (TerminalDevice->TerminalType == TerminalTypePcAnsi) { if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
TerminalDevice->TerminalType == TerminalTypeSCO) {
Key.ScanCode = SCAN_F6; Key.ScanCode = SCAN_F6;
} }
break; break;
case 'S': case 'S':
if (TerminalDevice->TerminalType == TerminalTypePcAnsi) { if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
TerminalDevice->TerminalType == TerminalTypeSCO) {
Key.ScanCode = SCAN_F7; Key.ScanCode = SCAN_F7;
} }
break; break;
case 'T': case 'T':
if (TerminalDevice->TerminalType == TerminalTypePcAnsi) { if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
TerminalDevice->TerminalType == TerminalTypeSCO) {
Key.ScanCode = SCAN_F8; Key.ScanCode = SCAN_F8;
} }
break; break;
case 'W':
if (TerminalDevice->TerminalType == TerminalTypeSCO) {
Key.ScanCode = SCAN_F11;
}
break;
default : default :
break; break;
} }
@ -1704,7 +1821,7 @@ UnicodeToEfiKey (
UnicodeChar <= '9') { UnicodeChar <= '9') {
TerminalDevice->TtyEscapeStr[0] = UnicodeChar; TerminalDevice->TtyEscapeStr[0] = UnicodeChar;
TerminalDevice->TtyEscapeIndex = 1; TerminalDevice->TtyEscapeIndex = 1;
TerminalDevice->InputState |= INPUT_STATE_LEFTOPENBRACKET_2; TerminalDevice->InputState |= INPUT_STATE_LEFTOPENBRACKET_TTY;
continue; continue;
} }
@ -1720,8 +1837,139 @@ UnicodeToEfiKey (
break; break;
case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET | INPUT_STATE_1:
case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET | INPUT_STATE_LEFTOPENBRACKET_2: TerminalDevice->ResetState = RESET_STATE_DEFAULT;
Key.ScanCode = SCAN_NULL;
if (TerminalDevice->TerminalType == TerminalTypeXtermR6 ||
TerminalDevice->TerminalType == TerminalTypeVt400 ||
TerminalDevice->TerminalType == TerminalTypeLinux) {
switch (UnicodeChar) {
case '1':
if (TerminalDevice->TerminalType == TerminalTypeVt400) {
Key.ScanCode = SCAN_F1;
}
break;
case '2':
if (TerminalDevice->TerminalType == TerminalTypeVt400) {
Key.ScanCode = SCAN_F2;
}
break;
case '3':
if (TerminalDevice->TerminalType == TerminalTypeVt400) {
Key.ScanCode = SCAN_F3;
}
break;
case '4':
if (TerminalDevice->TerminalType == TerminalTypeVt400) {
Key.ScanCode = SCAN_F4;
}
break;
case '5':
if (TerminalDevice->TerminalType == TerminalTypeXtermR6 ||
TerminalDevice->TerminalType == TerminalTypeVt400) {
Key.ScanCode = SCAN_F5;
}
break;
case '7':
Key.ScanCode = SCAN_F6;
break;
case '8':
Key.ScanCode = SCAN_F7;
break;
case '9':
Key.ScanCode = SCAN_F8;
break;
}
}
if (Key.ScanCode != SCAN_NULL) {
Key.UnicodeChar = 0;
EfiKeyFiFoInsertOneKey (TerminalDevice, &Key);
TerminalDevice->InputState = INPUT_STATE_DEFAULT;
UnicodeToEfiKeyFlushState (TerminalDevice);
continue;
}
UnicodeToEfiKeyFlushState (TerminalDevice);
break;
case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET | INPUT_STATE_2:
TerminalDevice->InputState = INPUT_STATE_DEFAULT;
Key.ScanCode = SCAN_NULL;
if (TerminalDevice->TerminalType == TerminalTypeXtermR6 ||
TerminalDevice->TerminalType == TerminalTypeVt400 ||
TerminalDevice->TerminalType == TerminalTypeLinux) {
switch (UnicodeChar) {
case '0':
Key.ScanCode = SCAN_F9;
break;
case '1':
Key.ScanCode = SCAN_F10;
break;
case '3':
Key.ScanCode = SCAN_F11;
break;
case '4':
Key.ScanCode = SCAN_F12;
break;
}
}
if (Key.ScanCode != SCAN_NULL) {
Key.UnicodeChar = 0;
EfiKeyFiFoInsertOneKey (TerminalDevice, &Key);
TerminalDevice->InputState = INPUT_STATE_DEFAULT;
UnicodeToEfiKeyFlushState (TerminalDevice);
continue;
}
UnicodeToEfiKeyFlushState (TerminalDevice);
break;
case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET | INPUT_STATE_LEFTOPENBRACKET_2ND:
TerminalDevice->InputState = INPUT_STATE_DEFAULT;
Key.ScanCode = SCAN_NULL;
if (TerminalDevice->TerminalType == TerminalTypeLinux) {
switch (UnicodeChar) {
case 'A':
Key.ScanCode = SCAN_F1;
break;
case 'B':
Key.ScanCode = SCAN_F2;
break;
case 'C':
Key.ScanCode = SCAN_F3;
break;
case 'D':
Key.ScanCode = SCAN_F4;
break;
case 'E':
Key.ScanCode = SCAN_F5;
break;
}
}
if (Key.ScanCode != SCAN_NULL) {
Key.UnicodeChar = 0;
EfiKeyFiFoInsertOneKey (TerminalDevice, &Key);
TerminalDevice->InputState = INPUT_STATE_DEFAULT;
UnicodeToEfiKeyFlushState (TerminalDevice);
continue;
}
UnicodeToEfiKeyFlushState (TerminalDevice);
break;
case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET | INPUT_STATE_LEFTOPENBRACKET_TTY:
/* /*
* Here we handle the VT220 escape codes that we accept. This * Here we handle the VT220 escape codes that we accept. This
* state is only used by the TTY terminal type. * state is only used by the TTY terminal type.

View File

@ -222,6 +222,10 @@ TerminalConOutOutputString (
case TerminalTypeVt100: case TerminalTypeVt100:
case TerminalTypeVt100Plus: case TerminalTypeVt100Plus:
case TerminalTypeTtyTerm: case TerminalTypeTtyTerm:
case TerminalTypeLinux:
case TerminalTypeXtermR6:
case TerminalTypeVt400:
case TerminalTypeSCO:
if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiChar)) { if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiChar)) {
// //

View File

@ -5,7 +5,7 @@
# protocols based on Serial I/O protocol for serial devices including hotplug serial # protocols based on Serial I/O protocol for serial devices including hotplug serial
# devices. # devices.
# #
# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent # SPDX-License-Identifier: BSD-2-Clause-Patent
# #
# #
@ -69,6 +69,10 @@
gEfiVT100PlusGuid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path gEfiVT100PlusGuid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path
gEfiPcAnsiGuid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path gEfiPcAnsiGuid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path
gEfiTtyTermGuid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path gEfiTtyTermGuid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path
gEdkiiLinuxTermGuid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path
gEdkiiXtermR6Guid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path
gEdkiiVT400Guid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path
gEdkiiSCOTermGuid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path
gEdkiiStatusCodeDataTypeVariableGuid ## SOMETIMES_CONSUMES ## GUID gEdkiiStatusCodeDataTypeVariableGuid ## SOMETIMES_CONSUMES ## GUID
[Protocols] [Protocols]