public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types
@ 2019-09-17  6:19 Gao, Zhichao
  2019-09-17  6:19 ` [PATCH V2 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console Gao, Zhichao
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Gao, Zhichao @ 2019-09-17  6:19 UTC (permalink / raw)
  To: devel
  Cc: Jian J Wang, Hao A Wu, Ray Ni, Ard Biesheuvel, Laszlo Ersek,
	Liming Gao

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

Putty is a very popular terminal tool in windows. So add the whole support
terminal keyboard type for it. The new introduced type is Linux, XtermR6,
VT400 and SCO. And enhance the support for VT100+.
This patch set only add the support of function key. Refer to the link:
https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-funkeys

V2:
Fix typo.
Merge the type guid defination into TtyTerm.h.

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: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-of-by: Zhichao Gao <zhichao.gao@intel.com>

Zhichao Gao (3):
  MdeModulePkg: Extend the support keyboard type of Terminal console
  MdeModulePkg/TerminalDxe: Extend the terminal console support types
  MdeModulePkg/BM_UI: Add the new terminal types to related menu

 MdeModulePkg/Include/Guid/TtyTerm.h           |  13 +
 .../BootMaintenanceManager.h                  |  12 +-
 .../BootMaintenanceManagerStrings.uni         |  10 +-
 .../ConsoleOption.c                           |  35 +--
 .../BootMaintenanceManagerUiLib/Data.c        |  16 +-
 MdeModulePkg/MdeModulePkg.dec                 |   4 +
 .../Universal/Console/TerminalDxe/Terminal.c  |  17 +-
 .../Universal/Console/TerminalDxe/Terminal.h  |  37 ++-
 .../Console/TerminalDxe/TerminalConIn.c       | 281 ++++++++++++++++--
 .../Console/TerminalDxe/TerminalConOut.c      |   4 +
 .../Console/TerminalDxe/TerminalDxe.inf       |   6 +-
 11 files changed, 375 insertions(+), 60 deletions(-)

-- 
2.21.0.windows.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH V2 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console
  2019-09-17  6:19 [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Gao, Zhichao
@ 2019-09-17  6:19 ` Gao, Zhichao
  2019-09-17  9:38   ` Laszlo Ersek
  2019-09-17  6:19 ` [PATCH V2 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types Gao, Zhichao
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Gao, Zhichao @ 2019-09-17  6:19 UTC (permalink / raw)
  To: devel
  Cc: Jian J Wang, Hao A Wu, Ray Ni, Ard Biesheuvel, Laszlo Ersek,
	Liming Gao

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

A common terminal console software Putty support various types of
keyboard type, such as normal mode, Linux mode, Xterm R6, Vt400,
VT100+ and SCO. Refer to the link:
https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-funkeys

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: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
---
 MdeModulePkg/Include/Guid/TtyTerm.h | 13 +++++++++++++
 MdeModulePkg/MdeModulePkg.dec       |  4 ++++
 2 files changed, 17 insertions(+)

diff --git a/MdeModulePkg/Include/Guid/TtyTerm.h b/MdeModulePkg/Include/Guid/TtyTerm.h
index 8333344b9d..19e0faa8bc 100644
--- a/MdeModulePkg/Include/Guid/TtyTerm.h
+++ b/MdeModulePkg/Include/Guid/TtyTerm.h
@@ -4,6 +4,7 @@ provide support for modern *nix terminals.
 
 
 Copyright (c) 2015  Linaro Ltd.
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -14,6 +15,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #define EFI_TTY_TERM_GUID    \
     {0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 } }
 
+#define EDKII_LINUX_MODE_GUID   \
+    {0xe4364a7f, 0xf825, 0x430e, {0x9d, 0x3a, 0x9c, 0x9b, 0xe6, 0x81, 0x7c, 0xa5 } }
+
+#define EDKII_XTERM_R6_GUID     \
+    {0xfbfca56b, 0xbb36, 0x4b78, {0xaa, 0xab, 0xbe, 0x1b, 0x97, 0xec, 0x7c, 0xcb } }
+
+#define EDKII_VT400_GUID        \
+    {0x8e46dddd, 0x3d49, 0x4a9d, {0xb8, 0x75, 0x3c, 0x08, 0x6f, 0x6a, 0xa2, 0xbd } }
+
+#define EDKII_SCO_GUID          \
+    {0xfc7dd6e0, 0x813c, 0x434d, {0xb4, 0xda, 0x3b, 0xd6, 0x49, 0xe9, 0xe1, 0x5a } }
+
 extern EFI_GUID gEfiTtyTermGuid;
 
 #endif
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 17beb45235..67b7bbd83d 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -342,6 +342,10 @@
 
   ## Include/Guid/TtyTerm.h
   gEfiTtyTermGuid                = { 0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 }}
+  gEdkiiLinuxModeGuid            = { 0xe4364a7f, 0xf825, 0x430e, {0x9d, 0x3a, 0x9c, 0x9b, 0xe6, 0x81, 0x7c, 0xa5 }}
+  gEdkiiXtermR6Guid              = { 0xfbfca56b, 0xbb36, 0x4b78, {0xaa, 0xab, 0xbe, 0x1b, 0x97, 0xec, 0x7c, 0xcb }}
+  gEdkiiVT400Guid                = { 0x8e46dddd, 0x3d49, 0x4a9d, {0xb8, 0x75, 0x3c, 0x08, 0x6f, 0x6a, 0xa2, 0xbd }}
+  gEdkiiSCOGuid                  = { 0xfc7dd6e0, 0x813c, 0x434d, {0xb4, 0xda, 0x3b, 0xd6, 0x49, 0xe9, 0xe1, 0x5a }}
 
   ## Include/Guid/HiiBootMaintenanceFormset.h
   gEfiIfrBootMaintenanceGuid      = { 0xb2dedc91, 0xd59f, 0x48d2, { 0x89, 0x8a, 0x12, 0x49, 0xc, 0x74, 0xa4, 0xe0 }}
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types
  2019-09-17  6:19 [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Gao, Zhichao
  2019-09-17  6:19 ` [PATCH V2 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console Gao, Zhichao
@ 2019-09-17  6:19 ` Gao, Zhichao
  2019-09-17  6:19 ` [PATCH V2 3/3] MdeModulePkg/BM_UI: Add the new terminal types to related menu Gao, Zhichao
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Gao, Zhichao @ 2019-09-17  6:19 UTC (permalink / raw)
  To: devel; +Cc: Jian J Wang, Hao A Wu, Ray Ni, Liming Gao

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>
---
 .../Universal/Console/TerminalDxe/Terminal.c  |  17 +-
 .../Universal/Console/TerminalDxe/Terminal.h  |  37 ++-
 .../Console/TerminalDxe/TerminalConIn.c       | 281 ++++++++++++++++--
 .../Console/TerminalDxe/TerminalConOut.c      |   4 +
 .../Console/TerminalDxe/TerminalDxe.inf       |   6 +-
 5 files changed, 319 insertions(+), 26 deletions(-)

diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
index c76b2c5100..526067d023 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
@@ -2,7 +2,7 @@
   Produces Simple Text Input Protocol, Simple Text Input Extended Protocol and
   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
 
 **/
@@ -28,7 +28,11 @@ EFI_GUID  *mTerminalType[] = {
   &gEfiVT100Guid,
   &gEfiVT100PlusGuid,
   &gEfiVTUTF8Guid,
-  &gEfiTtyTermGuid
+  &gEfiTtyTermGuid,
+  &gEdkiiLinuxModeGuid,
+  &gEdkiiXtermR6Guid,
+  &gEdkiiVT400Guid,
+  &gEdkiiSCOGuid
 };
 
 
@@ -37,7 +41,11 @@ CHAR16 *mSerialConsoleNames[] = {
   L"VT-100 Serial Console",
   L"VT-100+ Serial Console",
   L"VT-UTF8 Serial Console",
-  L"Tty Terminal Serial Console"
+  L"Tty Terminal Serial Console",
+  L"Linux Mode Terminal Serial Console",
+  L"Xterm R6 Terminal Serial Console",
+  L"VT400 Terminal Serial Console",
+  L"SCO Terminal Serial Console"
 };
 
 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)) {
         return EFI_UNSUPPORTED;
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
index b2f0901fc1..d683aa792f 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
@@ -1,7 +1,7 @@
 /** @file
   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>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -81,7 +81,11 @@ typedef enum {
   TerminalTypeVt100,
   TerminalTypeVt100Plus,
   TerminalTypeVtUtf8,
-  TerminalTypeTtyTerm
+  TerminalTypeTtyTerm,
+  TerminalTypeLinux,
+  TerminalTypeXtermR6,
+  TerminalTypeVt400,
+  TerminalTypeSCO
 } TERMINAL_TYPE;
 
 typedef struct {
@@ -126,7 +130,9 @@ typedef struct {
 #define INPUT_STATE_LEFTOPENBRACKET       0x04
 #define INPUT_STATE_O                     0x08
 #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_ESC_R                 0x01
@@ -848,7 +854,8 @@ TerminalRemoveConsoleDevVariable (
 /**
   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 or VT400.
   @param  ParentDevicePath       Parent device path.
   @param  TerminalDevicePath     Returned terminal device path, if building successfully.
 
@@ -1209,6 +1216,28 @@ AnsiRawDataToUnicode (
   | 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
   ================
   ESC R ESC r ESC R = Reset System
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
index 4ede416774..fb2eda01e7 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
@@ -2,7 +2,7 @@
   Implementation for EFI_SIMPLE_TEXT_INPUT_PROTOCOL protocol.
 
 (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>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -453,6 +453,10 @@ TranslateRawDataToEfiKey (
   case TerminalTypeVt100:
   case TerminalTypeVt100Plus:
   case TerminalTypeTtyTerm:
+  case TerminalTypeLinux:
+  case TerminalTypeXtermR6:
+  case TerminalTypeVt400:
+  case TerminalTypeSCO:
     AnsiRawDataToUnicode (TerminalDevice);
     UnicodeToEfiKey (TerminalDevice);
     break;
@@ -1319,6 +1323,27 @@ UnicodeToEfiKeyFlushState (
   | 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
   ================
   ESC R ESC r ESC R = Reset System
@@ -1378,7 +1403,9 @@ UnicodeToEfiKey (
       }
 
       if (UnicodeChar == 'O' && (TerminalDevice->TerminalType == TerminalTypeVt100 ||
-                                 TerminalDevice->TerminalType == TerminalTypeTtyTerm)) {
+                                 TerminalDevice->TerminalType == TerminalTypeTtyTerm ||
+                                 TerminalDevice->TerminalType == TerminalTypeXtermR6 ||
+                                 TerminalDevice->TerminalType == TerminalTypeVt100Plus)) {
         TerminalDevice->InputState |= INPUT_STATE_O;
         TerminalDevice->ResetState = RESET_STATE_DEFAULT;
         continue;
@@ -1548,6 +1575,60 @@ UnicodeToEfiKey (
           Key.ScanCode = SCAN_END;
           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) {
@@ -1564,15 +1645,33 @@ UnicodeToEfiKey (
 
     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;
 
       Key.ScanCode = SCAN_NULL;
 
       if (TerminalDevice->TerminalType == TerminalTypePcAnsi    ||
           TerminalDevice->TerminalType == TerminalTypeVt100     ||
-          TerminalDevice->TerminalType == TerminalTypeVt100Plus ||
-          TerminalDevice->TerminalType == TerminalTypeVtUtf8    ||
-          TerminalDevice->TerminalType == TerminalTypeTtyTerm) {
+          TerminalDevice->TerminalType == TerminalTypeVtUtf8 ||
+          TerminalDevice->TerminalType == TerminalTypeSCO) {
         switch (UnicodeChar) {
         case 'A':
           Key.ScanCode = SCAN_UP;
@@ -1614,12 +1713,15 @@ UnicodeToEfiKey (
         case 'X':
           if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
             Key.ScanCode = SCAN_DELETE;
+          } else if (TerminalDevice->TerminalType == TerminalTypeSCO) {
+            Key.ScanCode = SCAN_F12;
           }
           break;
         case 'P':
           if (TerminalDevice->TerminalType == TerminalTypeVt100) {
             Key.ScanCode = SCAN_DELETE;
-          } else if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
+          } else if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
+                      TerminalDevice->TerminalType == TerminalTypeSCO) {
             Key.ScanCode = SCAN_F4;
           }
           break;
@@ -1629,7 +1731,8 @@ UnicodeToEfiKey (
           }
           break;
         case 'V':
-          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
+          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
+              TerminalDevice->TerminalType == TerminalTypeSCO) {
             Key.ScanCode = SCAN_F10;
           }
           break;
@@ -1644,7 +1747,8 @@ UnicodeToEfiKey (
           }
           break;
         case 'U':
-          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
+          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
+              TerminalDevice->TerminalType == TerminalTypeSCO) {
             Key.ScanCode = SCAN_F9;
           }
           break;
@@ -1654,40 +1758,52 @@ UnicodeToEfiKey (
           }
           break;
         case 'M':
-          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
+          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
+              TerminalDevice->TerminalType == TerminalTypeSCO) {
             Key.ScanCode = SCAN_F1;
           }
           break;
         case 'N':
-          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
+          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
+              TerminalDevice->TerminalType == TerminalTypeSCO) {
             Key.ScanCode = SCAN_F2;
           }
           break;
         case 'O':
-          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
+          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
+              TerminalDevice->TerminalType == TerminalTypeSCO) {
             Key.ScanCode = SCAN_F3;
           }
           break;
         case 'Q':
-          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
+          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
+              TerminalDevice->TerminalType == TerminalTypeSCO) {
             Key.ScanCode = SCAN_F5;
           }
           break;
         case 'R':
-          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
+          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
+              TerminalDevice->TerminalType == TerminalTypeSCO) {
             Key.ScanCode = SCAN_F6;
           }
           break;
         case 'S':
-          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
+          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
+              TerminalDevice->TerminalType == TerminalTypeSCO) {
             Key.ScanCode = SCAN_F7;
           }
           break;
         case 'T':
-          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
+          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
+              TerminalDevice->TerminalType == TerminalTypeSCO) {
             Key.ScanCode = SCAN_F8;
           }
           break;
+        case 'W':
+          if (TerminalDevice->TerminalType == TerminalTypeSCO) {
+            Key.ScanCode = SCAN_F11;
+          }
+          break;
         default :
           break;
         }
@@ -1704,10 +1820,105 @@ UnicodeToEfiKey (
           UnicodeChar <= '9') {
         TerminalDevice->TtyEscapeStr[0] = UnicodeChar;
         TerminalDevice->TtyEscapeIndex = 1;
-        TerminalDevice->InputState |= INPUT_STATE_LEFTOPENBRACKET_2;
+        TerminalDevice->InputState |= INPUT_STATE_LEFTOPENBRACKET_TTY;
+        continue;
+      }
+
+      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_1:
+
+      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);
@@ -1720,8 +1931,44 @@ UnicodeToEfiKey (
 
       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_2:
+    case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET | INPUT_STATE_LEFTOPENBRACKET_TTY:
       /*
        * Here we handle the VT220 escape codes that we accept.  This
        * state is only used by the TTY terminal type.
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
index 7ef655cca5..aae470e956 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
@@ -222,6 +222,10 @@ TerminalConOutOutputString (
     case TerminalTypeVt100:
     case TerminalTypeVt100Plus:
     case TerminalTypeTtyTerm:
+    case TerminalTypeLinux:
+    case TerminalTypeXtermR6:
+    case TerminalTypeVt400:
+    case TerminalTypeSCO:
 
       if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiChar)) {
         //
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
index 24e164ef4d..e3785c3436 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
@@ -5,7 +5,7 @@
 #  protocols based on Serial I/O protocol for serial devices including hotplug serial
 #  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
 #
 #
@@ -69,6 +69,10 @@
   gEfiVT100PlusGuid                             ## 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
+  gEdkiiLinuxModeGuid                           ## 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
+  gEdkiiSCOGuid                                 ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path
   gEdkiiStatusCodeDataTypeVariableGuid          ## SOMETIMES_CONSUMES ## GUID
 
 [Protocols]
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 3/3] MdeModulePkg/BM_UI: Add the new terminal types to related menu
  2019-09-17  6:19 [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Gao, Zhichao
  2019-09-17  6:19 ` [PATCH V2 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console Gao, Zhichao
  2019-09-17  6:19 ` [PATCH V2 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types Gao, Zhichao
@ 2019-09-17  6:19 ` Gao, Zhichao
  2019-09-17  6:28 ` [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Ard Biesheuvel
       [not found] ` <15C5258FC1CFF61F.11658@groups.io>
  4 siblings, 0 replies; 13+ messages in thread
From: Gao, Zhichao @ 2019-09-17  6:19 UTC (permalink / raw)
  To: devel; +Cc: Jian J Wang, Hao A Wu, Ray Ni, Liming Gao

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

Add the new introduced terminal types to related setup menu to change
the terminal type from setup. Most platforms would have its own
configure setup menu and they need to change it to support these.
The new introduced terminal types are 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>
---
 .../BootMaintenanceManager.h                  | 12 ++++---
 .../BootMaintenanceManagerStrings.uni         | 10 +++++-
 .../ConsoleOption.c                           | 35 ++++++-------------
 .../BootMaintenanceManagerUiLib/Data.c        | 16 ++++++---
 4 files changed, 39 insertions(+), 34 deletions(-)

diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
index ea3cdce794..67847d8bf3 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
@@ -1,7 +1,7 @@
 /** @file
 Header file for boot maintenance module.
 
-Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -92,7 +92,11 @@ typedef enum _TYPE_OF_TERMINAL {
   TerminalTypeVt100,
   TerminalTypeVt100Plus,
   TerminalTypeVtUtf8,
-  TerminalTypeTtyTerm
+  TerminalTypeTtyTerm,
+  TerminalTypeLinux,
+  TerminalTypeXtermR6,
+  TerminalTypeVt400,
+  TerminalTypeSCO
 } TYPE_OF_TERMINAL;
 
 //
@@ -1301,12 +1305,12 @@ extern BM_MENU_OPTION             ConsoleOutMenu;
 extern BM_MENU_OPTION             ConsoleErrMenu;
 extern BM_MENU_OPTION             DriverMenu;
 extern BM_MENU_OPTION             TerminalMenu;
-extern UINT16                     TerminalType[5];
+extern UINT16                     TerminalType[9];
 extern COM_ATTR                   BaudRateList[19];
 extern COM_ATTR                   DataBitsList[4];
 extern COM_ATTR                   ParityList[5];
 extern COM_ATTR                   StopBitsList[3];
-extern EFI_GUID                   TerminalTypeGuid[5];
+extern EFI_GUID                   TerminalTypeGuid[9];
 extern EFI_DEVICE_PATH_PROTOCOL   EndDevicePath[];
 extern UINT16                     mFlowControlType[2];
 extern UINT32                     mFlowControlValue[2];
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerStrings.uni b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerStrings.uni
index 2e67d27bd0..3d47473e6c 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerStrings.uni
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerStrings.uni
@@ -1,7 +1,7 @@
 ///** @file
 //  String definitions for Boot Maintenance Utility.
 //
-//  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+//  Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
 //  SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 //**/
@@ -233,6 +233,14 @@
                                        #language fr-FR  "VT_UTF8"
 #string STR_COM_TYPE_4                 #language en-US  "TTY_TERM"
                                        #language fr-FR  "TTY_TERM"
+#string STR_COM_TYPE_5                 #language en-US  "LINUX"
+                                       #language fr-FR  "LINUX"
+#string STR_COM_TYPE_6                 #language en-US  "XTERM_R6"
+                                       #language fr-FR  "XTERM_R6"
+#string STR_COM_TYPE_7                 #language en-US  "VT_400"
+                                       #language fr-FR  "VT_400"
+#string STR_COM_TYPE_8                 #language en-US  "SCO"
+                                       #language fr-FR  "SCO"
 #string STR_RESET                      #language en-US  "Reset System"
                                        #language fr-FR  "Reset System"
 #string STR_FORM_GOTO_MAIN             #language en-US  "Go Back To Main Page"
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c
index 7a53b58771..b0641c5ee9 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c
@@ -897,6 +897,7 @@ IsTerminalDevicePath (
   VENDOR_DEVICE_PATH        *Vendor;
   UART_DEVICE_PATH          *Uart;
   ACPI_HID_DEVICE_PATH      *Acpi;
+  UINTN                     Index;
 
   IsTerminal = FALSE;
 
@@ -929,37 +930,21 @@ IsTerminalDevicePath (
   }
 
   //
-  // There are four kinds of Terminal types
+  // There are 9 kinds of Terminal types
   // check to see whether this devicepath
   // is one of that type
   //
-  if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[0])) {
-    *Termi      = TerminalTypePcAnsi;
-    IsTerminal  = TRUE;
-  } else {
-    if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[1])) {
-      *Termi      = TerminalTypeVt100;
-      IsTerminal  = TRUE;
-    } else {
-      if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[2])) {
-        *Termi      = TerminalTypeVt100Plus;
-        IsTerminal  = TRUE;
-      } else {
-        if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[3])) {
-          *Termi      = TerminalTypeVtUtf8;
-          IsTerminal  = TRUE;
-        } else {
-          if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[4])) {
-            *Termi      = TerminalTypeTtyTerm;
-            IsTerminal  = TRUE;
-          } else {
-            IsTerminal = FALSE;
-          }
-        }
-      }
+  for (Index = 0; Index < ARRAY_SIZE (TerminalTypeGuid); Index++) {
+    if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[Index])) {
+      *Termi = Index;
+      IsTerminal = TRUE;
     }
   }
 
+  if (Index == ARRAY_SIZE (TerminalTypeGuid)) {
+    IsTerminal = FALSE;
+  }
+
   if (!IsTerminal) {
     return FALSE;
   }
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Data.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Data.c
index b9d86b09d8..5cd363c982 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Data.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Data.c
@@ -1,7 +1,7 @@
 /** @file
 Define some data used for Boot Maint
 
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -16,12 +16,16 @@ EFI_IFR_GUID_LABEL  *mEndLabel = NULL;
 ///
 /// Terminal type string token storage
 ///
-UINT16              TerminalType[] = {
+UINT16              TerminalType[9] = {
   STRING_TOKEN(STR_COM_TYPE_0),
   STRING_TOKEN(STR_COM_TYPE_1),
   STRING_TOKEN(STR_COM_TYPE_2),
   STRING_TOKEN(STR_COM_TYPE_3),
   STRING_TOKEN(STR_COM_TYPE_4),
+  STRING_TOKEN(STR_COM_TYPE_5),
+  STRING_TOKEN(STR_COM_TYPE_6),
+  STRING_TOKEN(STR_COM_TYPE_7),
+  STRING_TOKEN(STR_COM_TYPE_8),
 };
 
 ///
@@ -248,10 +252,14 @@ COM_ATTR            StopBitsList[3] = {
 ///
 /// Guid for messaging path, used in Serial port setting.
 ///
-EFI_GUID            TerminalTypeGuid[] = {
+EFI_GUID            TerminalTypeGuid[9] = {
   DEVICE_PATH_MESSAGING_PC_ANSI,
   DEVICE_PATH_MESSAGING_VT_100,
   DEVICE_PATH_MESSAGING_VT_100_PLUS,
   DEVICE_PATH_MESSAGING_VT_UTF8,
-  EFI_TTY_TERM_GUID
+  EFI_TTY_TERM_GUID,
+  EDKII_LINUX_MODE_GUID,
+  EDKII_XTERM_R6_GUID,
+  EDKII_VT400_GUID,
+  EDKII_SCO_GUID
 };
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types
  2019-09-17  6:19 [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Gao, Zhichao
                   ` (2 preceding siblings ...)
  2019-09-17  6:19 ` [PATCH V2 3/3] MdeModulePkg/BM_UI: Add the new terminal types to related menu Gao, Zhichao
@ 2019-09-17  6:28 ` Ard Biesheuvel
  2019-09-17  6:47   ` Liming Gao
  2019-09-17  7:17   ` Zhang, Shenglei
       [not found] ` <15C5258FC1CFF61F.11658@groups.io>
  4 siblings, 2 replies; 13+ messages in thread
From: Ard Biesheuvel @ 2019-09-17  6:28 UTC (permalink / raw)
  To: Gao, Zhichao
  Cc: edk2-devel-groups-io, Jian J Wang, Hao A Wu, Ray Ni, Laszlo Ersek,
	Liming Gao

On Tue, 17 Sep 2019 at 07:22, Gao, Zhichao <zhichao.gao@intel.com> wrote:
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2186
>
> Putty is a very popular terminal tool in windows. So add the whole support
> terminal keyboard type for it. The new introduced type is Linux, XtermR6,
> VT400 and SCO. And enhance the support for VT100+.
> This patch set only add the support of function key. Refer to the link:
> https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-funkeys
>
> V2:
> Fix typo.
> Merge the type guid defination into TtyTerm.h.
>

Hello Zhichao,

Since you already pushed the broken patch, you should really be
posting an updated patch with just the fix.

In any case, this makes me wonder how you tested this code, since it
won't even build. Could you elaborate?

-- 
Ard.


> 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: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Signed-of-by: Zhichao Gao <zhichao.gao@intel.com>
>
> Zhichao Gao (3):
>   MdeModulePkg: Extend the support keyboard type of Terminal console
>   MdeModulePkg/TerminalDxe: Extend the terminal console support types
>   MdeModulePkg/BM_UI: Add the new terminal types to related menu
>
>  MdeModulePkg/Include/Guid/TtyTerm.h           |  13 +
>  .../BootMaintenanceManager.h                  |  12 +-
>  .../BootMaintenanceManagerStrings.uni         |  10 +-
>  .../ConsoleOption.c                           |  35 +--
>  .../BootMaintenanceManagerUiLib/Data.c        |  16 +-
>  MdeModulePkg/MdeModulePkg.dec                 |   4 +
>  .../Universal/Console/TerminalDxe/Terminal.c  |  17 +-
>  .../Universal/Console/TerminalDxe/Terminal.h  |  37 ++-
>  .../Console/TerminalDxe/TerminalConIn.c       | 281 ++++++++++++++++--
>  .../Console/TerminalDxe/TerminalConOut.c      |   4 +
>  .../Console/TerminalDxe/TerminalDxe.inf       |   6 +-
>  11 files changed, 375 insertions(+), 60 deletions(-)
>
> --
> 2.21.0.windows.1
>
>
> 
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types
  2019-09-17  6:28 ` [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Ard Biesheuvel
@ 2019-09-17  6:47   ` Liming Gao
  2019-09-17  7:16     ` Gao, Zhichao
  2019-09-17  7:17   ` Zhang, Shenglei
  1 sibling, 1 reply; 13+ messages in thread
From: Liming Gao @ 2019-09-17  6:47 UTC (permalink / raw)
  To: Ard Biesheuvel, Gao, Zhichao
  Cc: edk2-devel-groups-io, Wang, Jian J, Wu, Hao A, Ni, Ray,
	Laszlo Ersek

Ard:
  Thanks for your quick report. The break is caused by the patch [edk2-devel] [PATCH 2/2] MdeModulePkg/SerialDxe: Update the file Guid in SerialDxe.inf. 
  This patch updates FILE_GUID only. But, its GUID value format is wrong. I just send the fix for it. 

Thanks
Liming
>-----Original Message-----
>From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
>Sent: Tuesday, September 17, 2019 2:29 PM
>To: Gao, Zhichao <zhichao.gao@intel.com>
>Cc: edk2-devel-groups-io <devel@edk2.groups.io>; Wang, Jian J
><jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray
><ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Gao, Liming
><liming.gao@intel.com>
>Subject: Re: [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole:
>Extend the support terminal types
>
>On Tue, 17 Sep 2019 at 07:22, Gao, Zhichao <zhichao.gao@intel.com> wrote:
>>
>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2186
>>
>> Putty is a very popular terminal tool in windows. So add the whole support
>> terminal keyboard type for it. The new introduced type is Linux, XtermR6,
>> VT400 and SCO. And enhance the support for VT100+.
>> This patch set only add the support of function key. Refer to the link:
>> https://www.ssh.com/ssh/putty/putty-
>manuals/0.68/Chapter4.html#config-funkeys
>>
>> V2:
>> Fix typo.
>> Merge the type guid defination into TtyTerm.h.
>>
>
>Hello Zhichao,
>
>Since you already pushed the broken patch, you should really be
>posting an updated patch with just the fix.
>
>In any case, this makes me wonder how you tested this code, since it
>won't even build. Could you elaborate?
>
>--
>Ard.
>
>
>> 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: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Laszlo Ersek <lersek@redhat.com>
>> Cc: Liming Gao <liming.gao@intel.com>
>> Signed-of-by: Zhichao Gao <zhichao.gao@intel.com>
>>
>> Zhichao Gao (3):
>>   MdeModulePkg: Extend the support keyboard type of Terminal console
>>   MdeModulePkg/TerminalDxe: Extend the terminal console support types
>>   MdeModulePkg/BM_UI: Add the new terminal types to related menu
>>
>>  MdeModulePkg/Include/Guid/TtyTerm.h           |  13 +
>>  .../BootMaintenanceManager.h                  |  12 +-
>>  .../BootMaintenanceManagerStrings.uni         |  10 +-
>>  .../ConsoleOption.c                           |  35 +--
>>  .../BootMaintenanceManagerUiLib/Data.c        |  16 +-
>>  MdeModulePkg/MdeModulePkg.dec                 |   4 +
>>  .../Universal/Console/TerminalDxe/Terminal.c  |  17 +-
>>  .../Universal/Console/TerminalDxe/Terminal.h  |  37 ++-
>>  .../Console/TerminalDxe/TerminalConIn.c       | 281 ++++++++++++++++--
>>  .../Console/TerminalDxe/TerminalConOut.c      |   4 +
>>  .../Console/TerminalDxe/TerminalDxe.inf       |   6 +-
>>  11 files changed, 375 insertions(+), 60 deletions(-)
>>
>> --
>> 2.21.0.windows.1
>>
>>
>> 
>>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types
  2019-09-17  6:47   ` Liming Gao
@ 2019-09-17  7:16     ` Gao, Zhichao
  0 siblings, 0 replies; 13+ messages in thread
From: Gao, Zhichao @ 2019-09-17  7:16 UTC (permalink / raw)
  To: Gao, Liming, Ard Biesheuvel
  Cc: edk2-devel-groups-io, Wang, Jian J, Wu, Hao A, Ni, Ray,
	Laszlo Ersek

Thanks Liming to clarify my confusion. I just want to know which broken patch is in my patch set.

> -----Original Message-----
> From: Gao, Liming
> Sent: Tuesday, September 17, 2019 2:48 PM
> To: Ard Biesheuvel <ard.biesheuvel@linaro.org>; Gao, Zhichao
> <zhichao.gao@intel.com>
> Cc: edk2-devel-groups-io <devel@edk2.groups.io>; Wang, Jian J
> <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray
> <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: RE: [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole:
> Extend the support terminal types
> 
> Ard:
>   Thanks for your quick report. The break is caused by the patch [edk2-devel]
> [PATCH 2/2] MdeModulePkg/SerialDxe: Update the file Guid in SerialDxe.inf.
>   This patch updates FILE_GUID only. But, its GUID value format is wrong. I
> just send the fix for it.
> 
> Thanks
> Liming
> >-----Original Message-----
> >From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> >Sent: Tuesday, September 17, 2019 2:29 PM
> >To: Gao, Zhichao <zhichao.gao@intel.com>
> >Cc: edk2-devel-groups-io <devel@edk2.groups.io>; Wang, Jian J
> ><jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray
> ><ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Gao, Liming
> ><liming.gao@intel.com>
> >Subject: Re: [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole:
> >Extend the support terminal types
> >
> >On Tue, 17 Sep 2019 at 07:22, Gao, Zhichao <zhichao.gao@intel.com> wrote:
> >>
> >> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2186
> >>
> >> Putty is a very popular terminal tool in windows. So add the whole
> >> support terminal keyboard type for it. The new introduced type is
> >> Linux, XtermR6,
> >> VT400 and SCO. And enhance the support for VT100+.
> >> This patch set only add the support of function key. Refer to the link:
> >> https://www.ssh.com/ssh/putty/putty-
> >manuals/0.68/Chapter4.html#config-funkeys
> >>
> >> V2:
> >> Fix typo.
> >> Merge the type guid defination into TtyTerm.h.
> >>
> >
> >Hello Zhichao,
> >
> >Since you already pushed the broken patch, you should really be posting
> >an updated patch with just the fix.
> >
> >In any case, this makes me wonder how you tested this code, since it
> >won't even build. Could you elaborate?

I usually build the patch on my local machine. I didn't catch that fault because my code base isn't up to date. And I have already ported it to a real platform to verify the new introduced terminal type's function key. It works fine.
Here is the common steps:
1. Apply this patch set to the edk repo
2. change the BdsBootMaintainUI lib of the platform (some platform add this to its own setup driver) to support the new terminal type
3. change the PlatformBds library to make the whole terminal type legal because some platform only judge the types in PcAnsi.h as legal ones
4. register F1 to F12 at the UiApp entry point (for test only)
5. build bios image and flash to the platform
6. boot to setup and change the console terminal type
7. boot the SUT(system under test) with a UART connect to the host
8. open Putty in the host and change the terminal keyboard type to match with the setting in the setup
9. type function key to view if it can recognize the function correctly
10. go to 6 to verify the other terminal type

Thanks,
Zhichao

> >
> >--
> >Ard.
> >
> >
> >> 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: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> >> Cc: Laszlo Ersek <lersek@redhat.com>
> >> Cc: Liming Gao <liming.gao@intel.com>
> >> Signed-of-by: Zhichao Gao <zhichao.gao@intel.com>
> >>
> >> Zhichao Gao (3):
> >>   MdeModulePkg: Extend the support keyboard type of Terminal console
> >>   MdeModulePkg/TerminalDxe: Extend the terminal console support
> types
> >>   MdeModulePkg/BM_UI: Add the new terminal types to related menu
> >>
> >>  MdeModulePkg/Include/Guid/TtyTerm.h           |  13 +
> >>  .../BootMaintenanceManager.h                  |  12 +-
> >>  .../BootMaintenanceManagerStrings.uni         |  10 +-
> >>  .../ConsoleOption.c                           |  35 +--
> >>  .../BootMaintenanceManagerUiLib/Data.c        |  16 +-
> >>  MdeModulePkg/MdeModulePkg.dec                 |   4 +
> >>  .../Universal/Console/TerminalDxe/Terminal.c  |  17 +-
> >> .../Universal/Console/TerminalDxe/Terminal.h  |  37 ++-
> >>  .../Console/TerminalDxe/TerminalConIn.c       | 281 ++++++++++++++++--
> >>  .../Console/TerminalDxe/TerminalConOut.c      |   4 +
> >>  .../Console/TerminalDxe/TerminalDxe.inf       |   6 +-
> >>  11 files changed, 375 insertions(+), 60 deletions(-)
> >>
> >> --
> >> 2.21.0.windows.1
> >>
> >>
> >> 
> >>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types
  2019-09-17  6:28 ` [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Ard Biesheuvel
  2019-09-17  6:47   ` Liming Gao
@ 2019-09-17  7:17   ` Zhang, Shenglei
  2019-09-17  8:23     ` Ard Biesheuvel
  2019-09-17  9:14     ` Leif Lindholm
  1 sibling, 2 replies; 13+ messages in thread
From: Zhang, Shenglei @ 2019-09-17  7:17 UTC (permalink / raw)
  To: devel@edk2.groups.io, ard.biesheuvel@linaro.org
  Cc: Wang, Jian J, Wu, Hao A, Ni, Ray, Laszlo Ersek, Gao, Liming,
	Gao, Zhichao

Hi Ard,

That's my mistake to push the broken patch(0d85e67714e31e0dbe4241ab2ebb7c423aba174d).
This patch only updates the file guid, which I thought has no risk. So I didn’t check the build result. 
I should double check the new guid used in the file. Liming has help send a patch to fix this issue. 

Thanks,
Shenglei

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Ard Biesheuvel
> Sent: Tuesday, September 17, 2019 2:29 PM
> To: Gao, Zhichao <zhichao.gao@intel.com>
> Cc: edk2-devel-groups-io <devel@edk2.groups.io>; Wang, Jian J
> <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray
> <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Gao, Liming
> <liming.gao@intel.com>
> Subject: Re: [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole:
> Extend the support terminal types
> 
> On Tue, 17 Sep 2019 at 07:22, Gao, Zhichao <zhichao.gao@intel.com> wrote:
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2186
> >
> > Putty is a very popular terminal tool in windows. So add the whole support
> > terminal keyboard type for it. The new introduced type is Linux, XtermR6,
> > VT400 and SCO. And enhance the support for VT100+.
> > This patch set only add the support of function key. Refer to the link:
> > https://www.ssh.com/ssh/putty/putty-
> manuals/0.68/Chapter4.html#config-funkeys
> >
> > V2:
> > Fix typo.
> > Merge the type guid defination into TtyTerm.h.
> >
> 
> Hello Zhichao,
> 
> Since you already pushed the broken patch, you should really be
> posting an updated patch with just the fix.
> 
> In any case, this makes me wonder how you tested this code, since it
> won't even build. Could you elaborate?
> 
> --
> Ard.
> 
> 
> > 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: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Signed-of-by: Zhichao Gao <zhichao.gao@intel.com>
> >
> > Zhichao Gao (3):
> >   MdeModulePkg: Extend the support keyboard type of Terminal console
> >   MdeModulePkg/TerminalDxe: Extend the terminal console support types
> >   MdeModulePkg/BM_UI: Add the new terminal types to related menu
> >
> >  MdeModulePkg/Include/Guid/TtyTerm.h           |  13 +
> >  .../BootMaintenanceManager.h                  |  12 +-
> >  .../BootMaintenanceManagerStrings.uni         |  10 +-
> >  .../ConsoleOption.c                           |  35 +--
> >  .../BootMaintenanceManagerUiLib/Data.c        |  16 +-
> >  MdeModulePkg/MdeModulePkg.dec                 |   4 +
> >  .../Universal/Console/TerminalDxe/Terminal.c  |  17 +-
> >  .../Universal/Console/TerminalDxe/Terminal.h  |  37 ++-
> >  .../Console/TerminalDxe/TerminalConIn.c       | 281 ++++++++++++++++--
> >  .../Console/TerminalDxe/TerminalConOut.c      |   4 +
> >  .../Console/TerminalDxe/TerminalDxe.inf       |   6 +-
> >  11 files changed, 375 insertions(+), 60 deletions(-)
> >
> > --
> > 2.21.0.windows.1
> >
> >
> >
> >
> 
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [edk2-devel] [PATCH V2 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types
       [not found] ` <15C5258FC1CFF61F.11658@groups.io>
@ 2019-09-17  7:41   ` Gao, Zhichao
  0 siblings, 0 replies; 13+ messages in thread
From: Gao, Zhichao @ 2019-09-17  7:41 UTC (permalink / raw)
  To: devel@edk2.groups.io, Gao, Zhichao
  Cc: Wang, Jian J, Wu, Hao A, Ni, Ray, Gao, Liming



> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Gao, Zhichao
> Sent: Tuesday, September 17, 2019 2:19 PM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Ni, Ray <ray.ni@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [edk2-devel] [PATCH V2 2/3] 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>
> ---
>  .../Universal/Console/TerminalDxe/Terminal.c  |  17 +-
>   .../Universal/Console/TerminalDxe/Terminal.h  |  37 ++-
>  .../Console/TerminalDxe/TerminalConIn.c       | 281 ++++++++++++++++--
>  .../Console/TerminalDxe/TerminalConOut.c      |   4 +
>  .../Console/TerminalDxe/TerminalDxe.inf       |   6 +-
>  5 files changed, 319 insertions(+), 26 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> index c76b2c5100..526067d023 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> @@ -2,7 +2,7 @@
>    Produces Simple Text Input Protocol, Simple Text Input Extended Protocol
> and
>    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
> 
>  **/
> @@ -28,7 +28,11 @@ EFI_GUID  *mTerminalType[] = {
>    &gEfiVT100Guid,
>    &gEfiVT100PlusGuid,
>    &gEfiVTUTF8Guid,
> -  &gEfiTtyTermGuid
> +  &gEfiTtyTermGuid,
> +  &gEdkiiLinuxModeGuid,
> +  &gEdkiiXtermR6Guid,
> +  &gEdkiiVT400Guid,
> +  &gEdkiiSCOGuid
>  };
> 
> 
> @@ -37,7 +41,11 @@ CHAR16 *mSerialConsoleNames[] = {
>    L"VT-100 Serial Console",
>    L"VT-100+ Serial Console",
>    L"VT-UTF8 Serial Console",
> -  L"Tty Terminal Serial Console"
> +  L"Tty Terminal Serial Console",
> +  L"Linux Mode Terminal Serial Console",  L"Xterm R6 Terminal Serial
> + Console",
> +  L"VT400 Terminal Serial Console",
> +  L"SCO Terminal Serial Console"
>  };
> 
>  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)) {
>          return EFI_UNSUPPORTED;
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> index b2f0901fc1..d683aa792f 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> @@ -1,7 +1,7 @@
>  /** @file
>    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>
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -81,7 +81,11 @@ typedef enum {
>    TerminalTypeVt100,
>    TerminalTypeVt100Plus,
>    TerminalTypeVtUtf8,
> -  TerminalTypeTtyTerm
> +  TerminalTypeTtyTerm,
> +  TerminalTypeLinux,
> +  TerminalTypeXtermR6,
> +  TerminalTypeVt400,
> +  TerminalTypeSCO
>  } TERMINAL_TYPE;
> 
>  typedef struct {
> @@ -126,7 +130,9 @@ typedef struct {
>  #define INPUT_STATE_LEFTOPENBRACKET       0x04
>  #define INPUT_STATE_O                     0x08
>  #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_ESC_R                 0x01
> @@ -848,7 +854,8 @@ TerminalRemoveConsoleDevVariable (
>  /**
>    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 or VT400.
>    @param  ParentDevicePath       Parent device path.
>    @param  TerminalDevicePath     Returned terminal device path, if building
> successfully.
> 
> @@ -1209,6 +1216,28 @@ AnsiRawDataToUnicode (
>    | 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
>    ================
>    ESC R ESC r ESC R = Reset System
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
> b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
> index 4ede416774..fb2eda01e7 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
> @@ -2,7 +2,7 @@
>    Implementation for EFI_SIMPLE_TEXT_INPUT_PROTOCOL protocol.
> 
>  (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>
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -453,6 +453,10 @@ TranslateRawDataToEfiKey (
>    case TerminalTypeVt100:
>    case TerminalTypeVt100Plus:
>    case TerminalTypeTtyTerm:
> +  case TerminalTypeLinux:
> +  case TerminalTypeXtermR6:
> +  case TerminalTypeVt400:
> +  case TerminalTypeSCO:
>      AnsiRawDataToUnicode (TerminalDevice);
>      UnicodeToEfiKey (TerminalDevice);
>      break;
> @@ -1319,6 +1323,27 @@ UnicodeToEfiKeyFlushState (
>    | 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
>    ================
>    ESC R ESC r ESC R = Reset System
> @@ -1378,7 +1403,9 @@ UnicodeToEfiKey (
>        }
> 
>        if (UnicodeChar == 'O' && (TerminalDevice->TerminalType ==
> TerminalTypeVt100 ||
> -                                 TerminalDevice->TerminalType == TerminalTypeTtyTerm)) {
> +                                 TerminalDevice->TerminalType == TerminalTypeTtyTerm ||
> +                                 TerminalDevice->TerminalType == TerminalTypeXtermR6
> ||
> +                                 TerminalDevice->TerminalType ==
> + TerminalTypeVt100Plus)) {
>          TerminalDevice->InputState |= INPUT_STATE_O;
>          TerminalDevice->ResetState = RESET_STATE_DEFAULT;
>          continue;
> @@ -1548,6 +1575,60 @@ UnicodeToEfiKey (
>            Key.ScanCode = SCAN_END;
>            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) {
> @@ -1564,15 +1645,33 @@ UnicodeToEfiKey (
> 
>      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;
> 
>        Key.ScanCode = SCAN_NULL;
> 
>        if (TerminalDevice->TerminalType == TerminalTypePcAnsi    ||
>            TerminalDevice->TerminalType == TerminalTypeVt100     ||
> -          TerminalDevice->TerminalType == TerminalTypeVt100Plus ||
> -          TerminalDevice->TerminalType == TerminalTypeVtUtf8    ||
> -          TerminalDevice->TerminalType == TerminalTypeTtyTerm) {

Sorry for this part. I remove the TtyTerm incorrectly. The removal should be Vt100Plus only.

Thanks,
Zhichao

> +          TerminalDevice->TerminalType == TerminalTypeVtUtf8 ||
> +          TerminalDevice->TerminalType == TerminalTypeSCO) {
>          switch (UnicodeChar) {
>          case 'A':
>            Key.ScanCode = SCAN_UP;
> @@ -1614,12 +1713,15 @@ UnicodeToEfiKey (
>          case 'X':
>            if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
>              Key.ScanCode = SCAN_DELETE;
> +          } else if (TerminalDevice->TerminalType == TerminalTypeSCO) {
> +            Key.ScanCode = SCAN_F12;
>            }
>            break;
>          case 'P':
>            if (TerminalDevice->TerminalType == TerminalTypeVt100) {
>              Key.ScanCode = SCAN_DELETE;
> -          } else if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
> +          } else if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
> +                      TerminalDevice->TerminalType == TerminalTypeSCO)
> + {
>              Key.ScanCode = SCAN_F4;
>            }
>            break;
> @@ -1629,7 +1731,8 @@ UnicodeToEfiKey (
>            }
>            break;
>          case 'V':
> -          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
> +          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
> +              TerminalDevice->TerminalType == TerminalTypeSCO) {
>              Key.ScanCode = SCAN_F10;
>            }
>            break;
> @@ -1644,7 +1747,8 @@ UnicodeToEfiKey (
>            }
>            break;
>          case 'U':
> -          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
> +          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
> +              TerminalDevice->TerminalType == TerminalTypeSCO) {
>              Key.ScanCode = SCAN_F9;
>            }
>            break;
> @@ -1654,40 +1758,52 @@ UnicodeToEfiKey (
>            }
>            break;
>          case 'M':
> -          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
> +          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
> +              TerminalDevice->TerminalType == TerminalTypeSCO) {
>              Key.ScanCode = SCAN_F1;
>            }
>            break;
>          case 'N':
> -          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
> +          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
> +              TerminalDevice->TerminalType == TerminalTypeSCO) {
>              Key.ScanCode = SCAN_F2;
>            }
>            break;
>          case 'O':
> -          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
> +          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
> +              TerminalDevice->TerminalType == TerminalTypeSCO) {
>              Key.ScanCode = SCAN_F3;
>            }
>            break;
>          case 'Q':
> -          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
> +          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
> +              TerminalDevice->TerminalType == TerminalTypeSCO) {
>              Key.ScanCode = SCAN_F5;
>            }
>            break;
>          case 'R':
> -          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
> +          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
> +              TerminalDevice->TerminalType == TerminalTypeSCO) {
>              Key.ScanCode = SCAN_F6;
>            }
>            break;
>          case 'S':
> -          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
> +          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
> +              TerminalDevice->TerminalType == TerminalTypeSCO) {
>              Key.ScanCode = SCAN_F7;
>            }
>            break;
>          case 'T':
> -          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
> +          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
> +              TerminalDevice->TerminalType == TerminalTypeSCO) {
>              Key.ScanCode = SCAN_F8;
>            }
>            break;
> +        case 'W':
> +          if (TerminalDevice->TerminalType == TerminalTypeSCO) {
> +            Key.ScanCode = SCAN_F11;
> +          }
> +          break;
>          default :
>            break;
>          }
> @@ -1704,10 +1820,105 @@ UnicodeToEfiKey (
>            UnicodeChar <= '9') {
>          TerminalDevice->TtyEscapeStr[0] = UnicodeChar;
>          TerminalDevice->TtyEscapeIndex = 1;
> -        TerminalDevice->InputState |= INPUT_STATE_LEFTOPENBRACKET_2;
> +        TerminalDevice->InputState |= INPUT_STATE_LEFTOPENBRACKET_TTY;
> +        continue;
> +      }
> +
> +      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_1:
> +
> +      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); @@ -1720,8 +1931,44
> @@ UnicodeToEfiKey (
> 
>        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_2:
> +    case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET |
> INPUT_STATE_LEFTOPENBRACKET_TTY:
>        /*
>         * Here we handle the VT220 escape codes that we accept.  This
>         * state is only used by the TTY terminal type.
> diff --git
> a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
> b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
> index 7ef655cca5..aae470e956 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
> @@ -222,6 +222,10 @@ TerminalConOutOutputString (
>      case TerminalTypeVt100:
>      case TerminalTypeVt100Plus:
>      case TerminalTypeTtyTerm:
> +    case TerminalTypeLinux:
> +    case TerminalTypeXtermR6:
> +    case TerminalTypeVt400:
> +    case TerminalTypeSCO:
> 
>        if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiChar)) {
>          //
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> index 24e164ef4d..e3785c3436 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> @@ -5,7 +5,7 @@
>  #  protocols based on Serial I/O protocol for serial devices including hotplug
> serial  #  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  #  # @@ -69,6 +69,10 @@
>    gEfiVT100PlusGuid                             ## 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
> +  gEdkiiLinuxModeGuid                           ## 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
> +  gEdkiiSCOGuid                                 ## SOMETIMES_CONSUMES ## GUID #
> used with a Vendor-Defined Messaging Device Path
>    gEdkiiStatusCodeDataTypeVariableGuid          ## SOMETIMES_CONSUMES
> ## GUID
> 
>  [Protocols]
> --
> 2.21.0.windows.1
> 
> 
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types
  2019-09-17  7:17   ` Zhang, Shenglei
@ 2019-09-17  8:23     ` Ard Biesheuvel
  2019-09-17  9:14     ` Leif Lindholm
  1 sibling, 0 replies; 13+ messages in thread
From: Ard Biesheuvel @ 2019-09-17  8:23 UTC (permalink / raw)
  To: Zhang, Shenglei
  Cc: devel@edk2.groups.io, Wang, Jian J, Wu, Hao A, Ni, Ray,
	Laszlo Ersek, Gao, Liming, Gao, Zhichao

On Tue, 17 Sep 2019 at 08:17, Zhang, Shenglei <shenglei.zhang@intel.com> wrote:
>
> Hi Ard,
>
> That's my mistake to push the broken patch(0d85e67714e31e0dbe4241ab2ebb7c423aba174d).
> This patch only updates the file guid, which I thought has no risk. So I didn’t check the build result.
> I should double check the new guid used in the file. Liming has help send a patch to fix this issue.
>

I understand.

Please don't push changes without making sure they actually build.

Thanks,
Ard.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types
  2019-09-17  7:17   ` Zhang, Shenglei
  2019-09-17  8:23     ` Ard Biesheuvel
@ 2019-09-17  9:14     ` Leif Lindholm
  2019-09-17 14:32       ` Liming Gao
  1 sibling, 1 reply; 13+ messages in thread
From: Leif Lindholm @ 2019-09-17  9:14 UTC (permalink / raw)
  To: devel, shenglei.zhang
  Cc: ard.biesheuvel@linaro.org, Wang, Jian J, Wu, Hao A, Ni, Ray,
	Laszlo Ersek, Gao, Liming, Gao, Zhichao

On Tue, Sep 17, 2019 at 07:17:27AM +0000, Zhang, Shenglei wrote:
> That's my mistake to push the broken patch(0d85e67714e31e0dbe4241ab2ebb7c423aba174d).
> This patch only updates the file guid, which I thought has no risk. So I didn’t check the build result. 
> I should double check the new guid used in the file.

Determining what affects build and not is something humans are very
bad at and computers are very good at.

So you should build check every patch you submit to the list, no
matter how trivial.

In normal circumstances, so should the maintainers before pushing the
patch.

We now have a commit in the tree known to break the build of pretty
much all ARM/AARCH64 platforms. This will be very unpleasant for
future bisect.

Best Regards,

Leif

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH V2 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console
  2019-09-17  6:19 ` [PATCH V2 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console Gao, Zhichao
@ 2019-09-17  9:38   ` Laszlo Ersek
  0 siblings, 0 replies; 13+ messages in thread
From: Laszlo Ersek @ 2019-09-17  9:38 UTC (permalink / raw)
  To: Zhichao Gao, devel
  Cc: Jian J Wang, Hao A Wu, Ray Ni, Ard Biesheuvel, Liming Gao

On 09/17/19 08:19, Zhichao Gao wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2186
> 
> A common terminal console software Putty support various types of
> keyboard type, such as normal mode, Linux mode, Xterm R6, Vt400,
> VT100+ and SCO. Refer to the link:
> https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-funkeys
> 
> 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: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
> ---
>  MdeModulePkg/Include/Guid/TtyTerm.h | 13 +++++++++++++
>  MdeModulePkg/MdeModulePkg.dec       |  4 ++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/MdeModulePkg/Include/Guid/TtyTerm.h b/MdeModulePkg/Include/Guid/TtyTerm.h
> index 8333344b9d..19e0faa8bc 100644
> --- a/MdeModulePkg/Include/Guid/TtyTerm.h
> +++ b/MdeModulePkg/Include/Guid/TtyTerm.h
> @@ -4,6 +4,7 @@ provide support for modern *nix terminals.
>  
>  
>  Copyright (c) 2015  Linaro Ltd.
> +Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
>  SPDX-License-Identifier: BSD-2-Clause-Patent
>  
>  **/
> @@ -14,6 +15,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #define EFI_TTY_TERM_GUID    \
>      {0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 } }
>  
> +#define EDKII_LINUX_MODE_GUID   \
> +    {0xe4364a7f, 0xf825, 0x430e, {0x9d, 0x3a, 0x9c, 0x9b, 0xe6, 0x81, 0x7c, 0xa5 } }
> +
> +#define EDKII_XTERM_R6_GUID     \
> +    {0xfbfca56b, 0xbb36, 0x4b78, {0xaa, 0xab, 0xbe, 0x1b, 0x97, 0xec, 0x7c, 0xcb } }
> +
> +#define EDKII_VT400_GUID        \
> +    {0x8e46dddd, 0x3d49, 0x4a9d, {0xb8, 0x75, 0x3c, 0x08, 0x6f, 0x6a, 0xa2, 0xbd } }
> +
> +#define EDKII_SCO_GUID          \
> +    {0xfc7dd6e0, 0x813c, 0x434d, {0xb4, 0xda, 0x3b, 0xd6, 0x49, 0xe9, 0xe1, 0x5a } }
> +
>  extern EFI_GUID gEfiTtyTermGuid;
>  
>  #endif
> diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
> index 17beb45235..67b7bbd83d 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -342,6 +342,10 @@
>  
>    ## Include/Guid/TtyTerm.h
>    gEfiTtyTermGuid                = { 0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 }}
> +  gEdkiiLinuxModeGuid            = { 0xe4364a7f, 0xf825, 0x430e, {0x9d, 0x3a, 0x9c, 0x9b, 0xe6, 0x81, 0x7c, 0xa5 }}
> +  gEdkiiXtermR6Guid              = { 0xfbfca56b, 0xbb36, 0x4b78, {0xaa, 0xab, 0xbe, 0x1b, 0x97, 0xec, 0x7c, 0xcb }}
> +  gEdkiiVT400Guid                = { 0x8e46dddd, 0x3d49, 0x4a9d, {0xb8, 0x75, 0x3c, 0x08, 0x6f, 0x6a, 0xa2, 0xbd }}
> +  gEdkiiSCOGuid                  = { 0xfc7dd6e0, 0x813c, 0x434d, {0xb4, 0xda, 0x3b, 0xd6, 0x49, 0xe9, 0xe1, 0x5a }}
>  
>    ## Include/Guid/HiiBootMaintenanceFormset.h
>    gEfiIfrBootMaintenanceGuid      = { 0xb2dedc91, 0xd59f, 0x48d2, { 0x89, 0x8a, 0x12, 0x49, 0xc, 0x74, 0xa4, 0xe0 }}
> 

Shouldn't we put "Tty" or "Term" or "Terminal" somewhere in the symbolic
names of the GUIDs? "Xterm" and "VT400" are OK already, but "LinuxMode"
and "SCO" are too general, in my opinion.

Just a random comment, I defer to the MdeModulePkg maintainers.

Thanks
Laszlo

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types
  2019-09-17  9:14     ` Leif Lindholm
@ 2019-09-17 14:32       ` Liming Gao
  0 siblings, 0 replies; 13+ messages in thread
From: Liming Gao @ 2019-09-17 14:32 UTC (permalink / raw)
  To: Leif Lindholm, devel@edk2.groups.io, Zhang, Shenglei
  Cc: ard.biesheuvel@linaro.org, Wang, Jian J, Wu, Hao A, Ni, Ray,
	Laszlo Ersek, Gao, Zhichao

Leif:

> -----Original Message-----
> From: Leif Lindholm [mailto:leif.lindholm@linaro.org]
> Sent: Tuesday, September 17, 2019 5:15 PM
> To: devel@edk2.groups.io; Zhang, Shenglei <shenglei.zhang@intel.com>
> Cc: ard.biesheuvel@linaro.org; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>;
> Laszlo Ersek <lersek@redhat.com>; Gao, Liming <liming.gao@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> Subject: Re: [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types
> 
> On Tue, Sep 17, 2019 at 07:17:27AM +0000, Zhang, Shenglei wrote:
> > That's my mistake to push the broken patch(0d85e67714e31e0dbe4241ab2ebb7c423aba174d).
> > This patch only updates the file guid, which I thought has no risk. So I didn’t check the build result.
> > I should double check the new guid used in the file.
> 
> Determining what affects build and not is something humans are very
> bad at and computers are very good at.
> 
> So you should build check every patch you submit to the list, no
> matter how trivial.
> 
> In normal circumstances, so should the maintainers before pushing the
> patch.

I push this change. I should double confirm its test result. I will improve my rule.

> 
> We now have a commit in the tree known to break the build of pretty
> much all ARM/AARCH64 platforms. This will be very unpleasant for
> future bisect.

I agree the build break is the big impact. I expect we can speed up to enable EDK II Continuous Integration. 
If so, we can avoid such break again. 

Thanks
Liming
> 
> Best Regards,
> 
> Leif

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-09-17 14:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-17  6:19 [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Gao, Zhichao
2019-09-17  6:19 ` [PATCH V2 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console Gao, Zhichao
2019-09-17  9:38   ` Laszlo Ersek
2019-09-17  6:19 ` [PATCH V2 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types Gao, Zhichao
2019-09-17  6:19 ` [PATCH V2 3/3] MdeModulePkg/BM_UI: Add the new terminal types to related menu Gao, Zhichao
2019-09-17  6:28 ` [edk2-devel] [PATCH V2 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Ard Biesheuvel
2019-09-17  6:47   ` Liming Gao
2019-09-17  7:16     ` Gao, Zhichao
2019-09-17  7:17   ` Zhang, Shenglei
2019-09-17  8:23     ` Ard Biesheuvel
2019-09-17  9:14     ` Leif Lindholm
2019-09-17 14:32       ` Liming Gao
     [not found] ` <15C5258FC1CFF61F.11658@groups.io>
2019-09-17  7:41   ` [edk2-devel] [PATCH V2 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types Gao, Zhichao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox