public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V3 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types
@ 2019-09-18  5:33 Gao, Zhichao
  2019-09-18  5:33 ` [PATCH V3 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console Gao, Zhichao
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Gao, Zhichao @ 2019-09-18  5:33 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.

V3:
Fix incorrect removal of Ttyterm parse.
Change the guid name of terminal type linux and SCO to clear ones:
LinuxTerm and SCOTerm.

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       | 282 ++++++++++++++++--
 .../Console/TerminalDxe/TerminalConOut.c      |   4 +
 .../Console/TerminalDxe/TerminalDxe.inf       |   6 +-
 11 files changed, 376 insertions(+), 60 deletions(-)

-- 
2.21.0.windows.1


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

* [PATCH V3 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console
  2019-09-18  5:33 [PATCH V3 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Gao, Zhichao
@ 2019-09-18  5:33 ` Gao, Zhichao
  2019-09-18  8:46   ` Laszlo Ersek
  2019-09-19  1:54   ` [edk2-devel] " Wu, Hao A
  2019-09-18  5:33 ` [PATCH V3 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types Gao, Zhichao
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 12+ messages in thread
From: Gao, Zhichao @ 2019-09-18  5:33 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..471a651d4d 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_TERM_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_TERM_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..7f72c122fc 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 }}
+  gEdkiiLinuxTermGuid            = { 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 }}
+  gEdkiiSCOTermGuid              = { 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] 12+ messages in thread

* [PATCH V3 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types
  2019-09-18  5:33 [PATCH V3 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Gao, Zhichao
  2019-09-18  5:33 ` [PATCH V3 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console Gao, Zhichao
@ 2019-09-18  5:33 ` Gao, Zhichao
  2019-09-23  2:36   ` Ni, Ray
  2019-09-18  5:33 ` [PATCH V3 3/3] MdeModulePkg/BM_UI: Add the new terminal types to related menu Gao, Zhichao
  2019-09-19  1:57 ` [edk2-devel] [PATCH V3 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Wu, Hao A
  3 siblings, 1 reply; 12+ messages in thread
From: Gao, Zhichao @ 2019-09-18  5:33 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       | 282 ++++++++++++++++--
 .../Console/TerminalDxe/TerminalConOut.c      |   4 +
 .../Console/TerminalDxe/TerminalDxe.inf       |   6 +-
 5 files changed, 320 insertions(+), 26 deletions(-)

diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
index c76b2c5100..fd26e4dafe 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,
+  &gEdkiiLinuxTermGuid,
+  &gEdkiiXtermR6Guid,
+  &gEdkiiVT400Guid,
+  &gEdkiiSCOTermGuid
 };
 
 
@@ -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 Terminal Serial Console",
+  L"Xterm R6 Serial Console",
+  L"VT-400 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, VT400 and SCO.
   @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..ac31f27984 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,34 @@ 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 == TerminalTypeTtyTerm ||
+          TerminalDevice->TerminalType == TerminalTypeSCO) {
         switch (UnicodeChar) {
         case 'A':
           Key.ScanCode = SCAN_UP;
@@ -1614,12 +1714,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 +1732,8 @@ UnicodeToEfiKey (
           }
           break;
         case 'V':
-          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
+          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
+              TerminalDevice->TerminalType == TerminalTypeSCO) {
             Key.ScanCode = SCAN_F10;
           }
           break;
@@ -1644,7 +1748,8 @@ UnicodeToEfiKey (
           }
           break;
         case 'U':
-          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
+          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
+              TerminalDevice->TerminalType == TerminalTypeSCO) {
             Key.ScanCode = SCAN_F9;
           }
           break;
@@ -1654,40 +1759,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 +1821,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 +1932,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..b2a8aeba85 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
+  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
 
 [Protocols]
-- 
2.21.0.windows.1


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

* [PATCH V3 3/3] MdeModulePkg/BM_UI: Add the new terminal types to related menu
  2019-09-18  5:33 [PATCH V3 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Gao, Zhichao
  2019-09-18  5:33 ` [PATCH V3 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console Gao, Zhichao
  2019-09-18  5:33 ` [PATCH V3 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types Gao, Zhichao
@ 2019-09-18  5:33 ` Gao, Zhichao
  2019-09-20  3:04   ` [edk2-devel] " Dandan Bi
  2019-09-19  1:57 ` [edk2-devel] [PATCH V3 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Wu, Hao A
  3 siblings, 1 reply; 12+ messages in thread
From: Gao, Zhichao @ 2019-09-18  5:33 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..21c4ef3d55 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_TERM_GUID,
+  EDKII_XTERM_R6_GUID,
+  EDKII_VT400_GUID,
+  EDKII_SCO_TERM_GUID
 };
-- 
2.21.0.windows.1


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

* Re: [PATCH V3 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console
  2019-09-18  5:33 ` [PATCH V3 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console Gao, Zhichao
@ 2019-09-18  8:46   ` Laszlo Ersek
  2019-09-19  1:54   ` [edk2-devel] " Wu, Hao A
  1 sibling, 0 replies; 12+ messages in thread
From: Laszlo Ersek @ 2019-09-18  8:46 UTC (permalink / raw)
  To: Zhichao Gao, devel
  Cc: Jian J Wang, Hao A Wu, Ray Ni, Ard Biesheuvel, Liming Gao

On 09/18/19 07:33, 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..471a651d4d 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_TERM_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_TERM_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..7f72c122fc 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 }}
> +  gEdkiiLinuxTermGuid            = { 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 }}
> +  gEdkiiSCOTermGuid              = { 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 }}
> 

thank you, the new names look helpful.

Acked-by: Laszlo Ersek <lersek@redhat.com>

Thanks
Laszlo

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

* Re: [edk2-devel] [PATCH V3 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console
  2019-09-18  5:33 ` [PATCH V3 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console Gao, Zhichao
  2019-09-18  8:46   ` Laszlo Ersek
@ 2019-09-19  1:54   ` Wu, Hao A
  2019-09-19  4:28     ` Gao, Zhichao
  1 sibling, 1 reply; 12+ messages in thread
From: Wu, Hao A @ 2019-09-19  1:54 UTC (permalink / raw)
  To: devel@edk2.groups.io, Gao, Zhichao
  Cc: Wang, Jian J, Ni, Ray, Ard Biesheuvel, Laszlo Ersek, Gao, Liming

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Gao, Zhichao
> Sent: Wednesday, September 18, 2019 1:34 PM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ray; Ard Biesheuvel; Laszlo Ersek; Gao, Liming
> Subject: [edk2-devel] [PATCH V3 1/3] MdeModulePkg: Extend the support
> keyboard type of Terminal console
> 
> 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..471a651d4d 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_TERM_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_TERM_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..7f72c122fc 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 }}
> +  gEdkiiLinuxTermGuid            = { 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 }}
> +  gEdkiiSCOTermGuid              = { 0xfc7dd6e0, 0x813c, 0x434d, {0xb4, 0xda,
> 0x3b, 0xd6, 0x49, 0xe9, 0xe1, 0x5a }}


Since these 4 new GUIDs are listed under comments for file 'TtyTerm.h', I would
suggest to add these variable declarations in TtyTerm.h:

extern EFI_GUID gEdkiiLinuxTermGuid;
extern EFI_GUID gEdkiiXtermR6Guid;
extern EFI_GUID gEdkiiVT400Guid;
extern EFI_GUID gEdkiiSCOTermGuid;

With this handled,
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu


> 
>    ## Include/Guid/HiiBootMaintenanceFormset.h
>    gEfiIfrBootMaintenanceGuid      = { 0xb2dedc91, 0xd59f, 0x48d2, { 0x89, 0x8a,
> 0x12, 0x49, 0xc, 0x74, 0xa4, 0xe0 }}
> --
> 2.21.0.windows.1
> 
> 
> 


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

* Re: [edk2-devel] [PATCH V3 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types
  2019-09-18  5:33 [PATCH V3 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Gao, Zhichao
                   ` (2 preceding siblings ...)
  2019-09-18  5:33 ` [PATCH V3 3/3] MdeModulePkg/BM_UI: Add the new terminal types to related menu Gao, Zhichao
@ 2019-09-19  1:57 ` Wu, Hao A
  3 siblings, 0 replies; 12+ messages in thread
From: Wu, Hao A @ 2019-09-19  1:57 UTC (permalink / raw)
  To: devel@edk2.groups.io, Gao, Zhichao, Ni, Ray, Bi, Dandan,
	Dong, Eric
  Cc: Wang, Jian J, Ard Biesheuvel, Laszlo Ersek, Gao, Liming

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Gao, Zhichao
> Sent: Wednesday, September 18, 2019 1:34 PM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ray; Ard Biesheuvel; Laszlo Ersek; Gao, Liming
> Subject: [edk2-devel] [PATCH V3 0/3] MdeModulePkg/TerminalConsole:
> Extend the support terminal types
> 
> 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.
> 
> V3:
> Fix incorrect removal of Ttyterm parse.
> Change the guid name of terminal type linux and SCO to clear ones:
> LinuxTerm and SCOTerm.
> 
> 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


I will leave patch 2 & 3 to Console & UI reviewers.

Best Regards,
Hao Wu


> 
>  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       | 282 ++++++++++++++++--
>  .../Console/TerminalDxe/TerminalConOut.c      |   4 +
>  .../Console/TerminalDxe/TerminalDxe.inf       |   6 +-
>  11 files changed, 376 insertions(+), 60 deletions(-)
> 
> --
> 2.21.0.windows.1
> 
> 
> 


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

* Re: [edk2-devel] [PATCH V3 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console
  2019-09-19  1:54   ` [edk2-devel] " Wu, Hao A
@ 2019-09-19  4:28     ` Gao, Zhichao
  2019-09-19  5:11       ` Liming Gao
  0 siblings, 1 reply; 12+ messages in thread
From: Gao, Zhichao @ 2019-09-19  4:28 UTC (permalink / raw)
  To: Wu, Hao A, devel@edk2.groups.io
  Cc: Wang, Jian J, Ni, Ray, Ard Biesheuvel, Laszlo Ersek, Gao, Liming

Hi Hao,

I used to get comments from Mike not to add MARCO name and extern declaration of the GUIDs to the header file.
See https://edk2.groups.io/g/devel/message/40054.
The MARCO is used in the patch #3, so I kept it.

Thanks,
Zhichao

> -----Original Message-----
> From: Wu, Hao A
> Sent: Thursday, September 19, 2019 9:55 AM
> To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Ni, Ray <ray.ni@intel.com>; Ard
> Biesheuvel <ard.biesheuvel@linaro.org>; Laszlo Ersek <lersek@redhat.com>;
> Gao, Liming <liming.gao@intel.com>
> Subject: RE: [edk2-devel] [PATCH V3 1/3] MdeModulePkg: Extend the
> support keyboard type of Terminal console
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> > Gao, Zhichao
> > Sent: Wednesday, September 18, 2019 1:34 PM
> > To: devel@edk2.groups.io
> > Cc: Wang, Jian J; Wu, Hao A; Ni, Ray; Ard Biesheuvel; Laszlo Ersek;
> > Gao, Liming
> > Subject: [edk2-devel] [PATCH V3 1/3] MdeModulePkg: Extend the support
> > keyboard type of Terminal console
> >
> > 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..471a651d4d 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_TERM_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_TERM_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..7f72c122fc
> 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 }}
> > +  gEdkiiLinuxTermGuid            = { 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 }}
> > +  gEdkiiSCOTermGuid              = { 0xfc7dd6e0, 0x813c, 0x434d, {0xb4, 0xda,
> > 0x3b, 0xd6, 0x49, 0xe9, 0xe1, 0x5a }}
> 
> 
> Since these 4 new GUIDs are listed under comments for file 'TtyTerm.h', I
> would suggest to add these variable declarations in TtyTerm.h:
> 
> extern EFI_GUID gEdkiiLinuxTermGuid;
> extern EFI_GUID gEdkiiXtermR6Guid;
> extern EFI_GUID gEdkiiVT400Guid;
> extern EFI_GUID gEdkiiSCOTermGuid;
> 
> With this handled,
> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
> 
> Best Regards,
> Hao Wu
> 
> 
> >
> >    ## Include/Guid/HiiBootMaintenanceFormset.h
> >    gEfiIfrBootMaintenanceGuid      = { 0xb2dedc91, 0xd59f, 0x48d2, { 0x89,
> 0x8a,
> > 0x12, 0x49, 0xc, 0x74, 0xa4, 0xe0 }}
> > --
> > 2.21.0.windows.1
> >
> >
> > 


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

* Re: [edk2-devel] [PATCH V3 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console
  2019-09-19  4:28     ` Gao, Zhichao
@ 2019-09-19  5:11       ` Liming Gao
  0 siblings, 0 replies; 12+ messages in thread
From: Liming Gao @ 2019-09-19  5:11 UTC (permalink / raw)
  To: Gao, Zhichao, Wu, Hao A, devel@edk2.groups.io, Kinney, Michael D
  Cc: Wang, Jian J, Ni, Ray, Ard Biesheuvel, Laszlo Ersek

Zhichao:
  If GUID MACRO is not required, you don't need to add header file. But for this case, GUID MACRO is required. 
  So, you have to add the header file. Then, I suggest to add extern GuidCName together in this header file to match GUID MACRO. 

Thanks
Liming
>-----Original Message-----
>From: Gao, Zhichao
>Sent: Thursday, September 19, 2019 12:28 PM
>To: Wu, Hao A <hao.a.wu@intel.com>; devel@edk2.groups.io
>Cc: Wang, Jian J <jian.j.wang@intel.com>; Ni, Ray <ray.ni@intel.com>; Ard
>Biesheuvel <ard.biesheuvel@linaro.org>; Laszlo Ersek <lersek@redhat.com>;
>Gao, Liming <liming.gao@intel.com>
>Subject: RE: [edk2-devel] [PATCH V3 1/3] MdeModulePkg: Extend the
>support keyboard type of Terminal console
>
>Hi Hao,
>
>I used to get comments from Mike not to add MARCO name and extern
>declaration of the GUIDs to the header file.
>See https://edk2.groups.io/g/devel/message/40054.
>The MARCO is used in the patch #3, so I kept it.
>
>Thanks,
>Zhichao
>
>> -----Original Message-----
>> From: Wu, Hao A
>> Sent: Thursday, September 19, 2019 9:55 AM
>> To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>
>> Cc: Wang, Jian J <jian.j.wang@intel.com>; Ni, Ray <ray.ni@intel.com>; Ard
>> Biesheuvel <ard.biesheuvel@linaro.org>; Laszlo Ersek
><lersek@redhat.com>;
>> Gao, Liming <liming.gao@intel.com>
>> Subject: RE: [edk2-devel] [PATCH V3 1/3] MdeModulePkg: Extend the
>> support keyboard type of Terminal console
>>
>> > -----Original Message-----
>> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
>> > Gao, Zhichao
>> > Sent: Wednesday, September 18, 2019 1:34 PM
>> > To: devel@edk2.groups.io
>> > Cc: Wang, Jian J; Wu, Hao A; Ni, Ray; Ard Biesheuvel; Laszlo Ersek;
>> > Gao, Liming
>> > Subject: [edk2-devel] [PATCH V3 1/3] MdeModulePkg: Extend the
>support
>> > keyboard type of Terminal console
>> >
>> > 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..471a651d4d 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_TERM_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_TERM_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..7f72c122fc
>> 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 }}
>> > +  gEdkiiLinuxTermGuid            = { 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 }}
>> > +  gEdkiiSCOTermGuid              = { 0xfc7dd6e0, 0x813c, 0x434d, {0xb4, 0xda,
>> > 0x3b, 0xd6, 0x49, 0xe9, 0xe1, 0x5a }}
>>
>>
>> Since these 4 new GUIDs are listed under comments for file 'TtyTerm.h', I
>> would suggest to add these variable declarations in TtyTerm.h:
>>
>> extern EFI_GUID gEdkiiLinuxTermGuid;
>> extern EFI_GUID gEdkiiXtermR6Guid;
>> extern EFI_GUID gEdkiiVT400Guid;
>> extern EFI_GUID gEdkiiSCOTermGuid;
>>
>> With this handled,
>> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
>>
>> Best Regards,
>> Hao Wu
>>
>>
>> >
>> >    ## Include/Guid/HiiBootMaintenanceFormset.h
>> >    gEfiIfrBootMaintenanceGuid      = { 0xb2dedc91, 0xd59f, 0x48d2, { 0x89,
>> 0x8a,
>> > 0x12, 0x49, 0xc, 0x74, 0xa4, 0xe0 }}
>> > --
>> > 2.21.0.windows.1
>> >
>> >
>> > 


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

* Re: [edk2-devel] [PATCH V3 3/3] MdeModulePkg/BM_UI: Add the new terminal types to related menu
  2019-09-18  5:33 ` [PATCH V3 3/3] MdeModulePkg/BM_UI: Add the new terminal types to related menu Gao, Zhichao
@ 2019-09-20  3:04   ` Dandan Bi
  2019-09-20  5:50     ` Gao, Zhichao
  0 siblings, 1 reply; 12+ messages in thread
From: Dandan Bi @ 2019-09-20  3:04 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: Wednesday, September 18, 2019 1:34 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 V3 3/3] MdeModulePkg/BM_UI: Add the new
> terminal types to related menu
> 
> 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/BootMaintenanc
> eManager.h
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eManager.h
> index ea3cdce794..67847d8bf3 100644
> ---
> a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eManager.h
> +++
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eMa
> +++ nager.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/BootMaintenanc
> eManagerStrings.uni
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eManagerStrings.uni
> index 2e67d27bd0..3d47473e6c 100644
> ---
> a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eManagerStrings.uni
> +++
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eMa
> +++ nagerStrings.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;

 Hi Zhichao,

Thanks for simplifying this code logic. 
One comment here, I think you miss the "break" statement here, or the Index will increase to 9 and then "if (Index == ARRAY_SIZE (TerminalTypeGuid))" will be always true and "IsTerminal" variable is always FALSE, this is not the expected behavior. Please double check the code logic.

Thanks,
Dandan

>      }
>    }
> 
> +  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..21c4ef3d55 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_TERM_GUID,
> +  EDKII_XTERM_R6_GUID,
> +  EDKII_VT400_GUID,
> +  EDKII_SCO_TERM_GUID
>  };
> --
> 2.21.0.windows.1
> 
> 
> 


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

* Re: [edk2-devel] [PATCH V3 3/3] MdeModulePkg/BM_UI: Add the new terminal types to related menu
  2019-09-20  3:04   ` [edk2-devel] " Dandan Bi
@ 2019-09-20  5:50     ` Gao, Zhichao
  0 siblings, 0 replies; 12+ messages in thread
From: Gao, Zhichao @ 2019-09-20  5:50 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io
  Cc: Wang, Jian J, Wu, Hao A, Ni, Ray, Gao, Liming


> -----Original Message-----
> From: Bi, Dandan
> Sent: Friday, September 20, 2019 11:05 AM
> To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>
> 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: RE: [edk2-devel] [PATCH V3 3/3] MdeModulePkg/BM_UI: Add the
> new terminal types to related menu
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> > Gao, Zhichao
> > Sent: Wednesday, September 18, 2019 1:34 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 V3 3/3] MdeModulePkg/BM_UI: Add the
> new
> > terminal types to related menu
> >
> > 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/BootMaintenanc
> > eManager.h
> >
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> > eManager.h
> > index ea3cdce794..67847d8bf3 100644
> > ---
> >
> a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> > eManager.h
> > +++
> >
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> > eMa
> > +++ nager.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/BootMaintenanc
> > eManagerStrings.uni
> >
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> > eManagerStrings.uni
> > index 2e67d27bd0..3d47473e6c 100644
> > ---
> >
> a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> > eManagerStrings.uni
> > +++
> >
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> > eMa
> > +++ nagerStrings.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;
> 
>  Hi Zhichao,
> 
> Thanks for simplifying this code logic.
> One comment here, I think you miss the "break" statement here, or the
> Index will increase to 9 and then "if (Index == ARRAY_SIZE
> (TerminalTypeGuid))" will be always true and "IsTerminal" variable is always
> FALSE, this is not the expected behavior. Please double check the code logic.

Exactly right, I missed the "break". This lib is just an example for the terminal driver. Most platforms would have its own one. There is no example of real open platform to use this library.

Thanks,
Zhichao

> 
> Thanks,
> Dandan
> 
> >      }
> >    }
> >
> > +  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..21c4ef3d55 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_TERM_GUID,
> > +  EDKII_XTERM_R6_GUID,
> > +  EDKII_VT400_GUID,
> > +  EDKII_SCO_TERM_GUID
> >  };
> > --
> > 2.21.0.windows.1
> >
> >
> > 


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

* Re: [PATCH V3 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types
  2019-09-18  5:33 ` [PATCH V3 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types Gao, Zhichao
@ 2019-09-23  2:36   ` Ni, Ray
  0 siblings, 0 replies; 12+ messages in thread
From: Ni, Ray @ 2019-09-23  2:36 UTC (permalink / raw)
  To: Gao, Zhichao, devel@edk2.groups.io; +Cc: Wang, Jian J, Wu, Hao A, Gao, Liming

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Gao, Zhichao <zhichao.gao@intel.com>
> Sent: Tuesday, September 17, 2019 10:34 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: [PATCH V3 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       | 282 ++++++++++++++++--
>  .../Console/TerminalDxe/TerminalConOut.c      |   4 +
>  .../Console/TerminalDxe/TerminalDxe.inf       |   6 +-
>  5 files changed, 320 insertions(+), 26 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> index c76b2c5100..fd26e4dafe 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,
> +  &gEdkiiLinuxTermGuid,
> +  &gEdkiiXtermR6Guid,
> +  &gEdkiiVT400Guid,
> +  &gEdkiiSCOTermGuid
>  };
> 
> 
> @@ -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 Terminal Serial Console",
> +  L"Xterm R6 Serial Console",
> +  L"VT-400 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, VT400 and SCO.
>    @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..ac31f27984 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,34 @@ 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 == TerminalTypeTtyTerm ||
> +          TerminalDevice->TerminalType == TerminalTypeSCO) {
>          switch (UnicodeChar) {
>          case 'A':
>            Key.ScanCode = SCAN_UP;
> @@ -1614,12 +1714,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 +1732,8 @@ UnicodeToEfiKey (
>            }
>            break;
>          case 'V':
> -          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
> +          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
> +              TerminalDevice->TerminalType == TerminalTypeSCO) {
>              Key.ScanCode = SCAN_F10;
>            }
>            break;
> @@ -1644,7 +1748,8 @@ UnicodeToEfiKey (
>            }
>            break;
>          case 'U':
> -          if (TerminalDevice->TerminalType == TerminalTypePcAnsi) {
> +          if (TerminalDevice->TerminalType == TerminalTypePcAnsi ||
> +              TerminalDevice->TerminalType == TerminalTypeSCO) {
>              Key.ScanCode = SCAN_F9;
>            }
>            break;
> @@ -1654,40 +1759,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 +1821,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 +1932,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..b2a8aeba85 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
> +  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
> 
>  [Protocols]
> --
> 2.21.0.windows.1


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

end of thread, other threads:[~2019-09-23  2:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-18  5:33 [PATCH V3 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Gao, Zhichao
2019-09-18  5:33 ` [PATCH V3 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console Gao, Zhichao
2019-09-18  8:46   ` Laszlo Ersek
2019-09-19  1:54   ` [edk2-devel] " Wu, Hao A
2019-09-19  4:28     ` Gao, Zhichao
2019-09-19  5:11       ` Liming Gao
2019-09-18  5:33 ` [PATCH V3 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types Gao, Zhichao
2019-09-23  2:36   ` Ni, Ray
2019-09-18  5:33 ` [PATCH V3 3/3] MdeModulePkg/BM_UI: Add the new terminal types to related menu Gao, Zhichao
2019-09-20  3:04   ` [edk2-devel] " Dandan Bi
2019-09-20  5:50     ` Gao, Zhichao
2019-09-19  1:57 ` [edk2-devel] [PATCH V3 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types Wu, Hao A

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