Re: [edk2-devel] [PATCH V2 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types

2019-09-17 Thread Gao, Zhichao



> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Gao, Zhichao
> Sent: Tuesday, September 17, 2019 2:19 PM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J ; Wu, Hao A ;
> Ni, Ray ; Gao, Liming 
> Subject: [edk2-devel] [PATCH V2 2/3] MdeModulePkg/TerminalDxe: Extend
> the terminal console support types
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2186
> 
> Extend the support types of terminal console driver. New added types are
> Linux, XtermR6, VT400 and SCO.
> 
> Refer to
> https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-
> funkeys
> 
> Add the missing VT100+ function keys map.
> 
> Add F1-F12 function keys map for Linux, XtermR6, VT400 and SCO.
> 
> Cc: Jian J Wang 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Cc: Liming Gao 
> Signed-off-by: Zhichao Gao 
> ---
>  .../Universal/Console/TerminalDxe/Terminal.c  |  17 +-
>   .../Universal/Console/TerminalDxe/Terminal.h  |  37 ++-
>  .../Console/TerminalDxe/TerminalConIn.c   | 281 --
>  .../Console/TerminalDxe/TerminalConOut.c  |   4 +
>  .../Console/TerminalDxe/TerminalDxe.inf   |   6 +-
>  5 files changed, 319 insertions(+), 26 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> index c76b2c5100..526067d023 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> @@ -2,7 +2,7 @@
>Produces Simple Text Input Protocol, Simple Text Input Extended Protocol
> and
>Simple Text Output Protocol upon Serial IO Protocol.
> 
> -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -28,7 +28,11 @@ EFI_GUID  *mTerminalType[] = {
>,
>,
>,
> -  
> +  ,
> +  ,
> +  ,
> +  ,
> +  
>  };
> 
> 
> @@ -37,7 +41,11 @@ CHAR16 *mSerialConsoleNames[] = {
>L"VT-100 Serial Console",
>L"VT-100+ Serial Console",
>L"VT-UTF8 Serial Console",
> -  L"Tty Terminal Serial Console"
> +  L"Tty Terminal Serial Console",
> +  L"Linux Mode Terminal Serial Console",  L"Xterm R6 Terminal Serial
> + Console",
> +  L"VT400 Terminal Serial Console",
> +  L"SCO Terminal Serial Console"
>  };
> 
>  TERMINAL_DEV  mTerminalDevTemplate = {
> @@ -187,7 +195,8 @@ TerminalDriverBindingSupported (
> 
>}
>//
> -  // only supports PC ANSI, VT100, VT100+, VT-UTF8, and TtyTerm terminal
> types
> +  // only supports PC ANSI, VT100, VT100+, VT-UTF8, TtyTerm
> +  // Linux, XtermR6, VT400 and SCO terminal types
>//
>if (TerminalTypeFromGuid (>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.
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
>  Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.
>  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

[edk2-devel] [PATCH V2 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types

2019-09-17 Thread Gao, Zhichao
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 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Liming Gao 
Signed-off-by: Zhichao Gao 
---
 .../Universal/Console/TerminalDxe/Terminal.c  |  17 +-
 .../Universal/Console/TerminalDxe/Terminal.h  |  37 ++-
 .../Console/TerminalDxe/TerminalConIn.c   | 281 --
 .../Console/TerminalDxe/TerminalConOut.c  |   4 +
 .../Console/TerminalDxe/TerminalDxe.inf   |   6 +-
 5 files changed, 319 insertions(+), 26 deletions(-)

diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c 
b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
index c76b2c5100..526067d023 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
@@ -2,7 +2,7 @@
   Produces Simple Text Input Protocol, Simple Text Input Extended Protocol and
   Simple Text Output Protocol upon Serial IO Protocol.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -28,7 +28,11 @@ EFI_GUID  *mTerminalType[] = {
   ,
   ,
   ,
-  
+  ,
+  ,
+  ,
+  ,
+  
 };
 
 
@@ -37,7 +41,11 @@ CHAR16 *mSerialConsoleNames[] = {
   L"VT-100 Serial Console",
   L"VT-100+ Serial Console",
   L"VT-UTF8 Serial Console",
-  L"Tty Terminal Serial Console"
+  L"Tty Terminal Serial Console",
+  L"Linux Mode Terminal Serial Console",
+  L"Xterm R6 Terminal Serial Console",
+  L"VT400 Terminal Serial Console",
+  L"SCO Terminal Serial Console"
 };
 
 TERMINAL_DEV  mTerminalDevTemplate = {
@@ -187,7 +195,8 @@ TerminalDriverBindingSupported (
 
   }
   //
-  // only supports PC ANSI, VT100, VT100+, VT-UTF8, and TtyTerm terminal 
types
+  // only supports PC ANSI, VT100, VT100+, VT-UTF8, TtyTerm
+  // Linux, XtermR6, VT400 and SCO terminal types
   //
   if (TerminalTypeFromGuid (>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.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -81,7 +81,11 @@ typedef enum {
   TerminalTypeVt100,
   TerminalTypeVt100Plus,
   TerminalTypeVtUtf8,
-  TerminalTypeTtyTerm
+  TerminalTypeTtyTerm,
+  TerminalTypeLinux,
+  TerminalTypeXtermR6,
+  TerminalTypeVt400,
+  TerminalTypeSCO
 } TERMINAL_TYPE;
 
 typedef struct {
@@ -126,7 +130,9 @@ typedef struct {
 #define INPUT_STATE_LEFTOPENBRACKET   0x04
 #define INPUT_STATE_O 0x08
 #define INPUT_STATE_2 0x10
-#define INPUT_STATE_LEFTOPENBRACKET_2 0x20
+#define INPUT_STATE_LEFTOPENBRACKET_TTY   0x20
+#define INPUT_STATE_1 0x40
+#define INPUT_STATE_LEFTOPENBRACKET_2ND   0x80
 
 #define RESET_STATE_DEFAULT   0x00
 #define RESET_STATE_ESC_R 0x01
@@ -848,7 +854,8 @@ TerminalRemoveConsoleDevVariable (
 /**
   Build termial device path according to terminal type.
 
-  @param  TerminalType   The terminal type is PC ANSI, VT100, VT100+ 
or VT-UTF8.
+  @param  TerminalType   The terminal type is PC ANSI, VT100, VT100+, 
VT-UTF8, TTY-Term,
+ Linux, XtermR6 or VT400.
   @param  ParentDevicePath   Parent device path.
   @param  TerminalDevicePath Returned terminal device path, if building 
successfully.
 
@@ -1209,6 +1216,28 @@ AnsiRawDataToUnicode (
   | F12 | 0x16 |   | ESC @|  |
   +=+==+===+==+==+
 
+Putty function key map:
+  
+=+==+===+=+=+=+=+
+  | | EFI  |   | | | | 
|
+  | | Scan |   | |  Normal | | 
|
+  |   KEY   | Code |  VT100+   | Xterm R6|  VT400  | Linux   | SCO 
|
+  
+=+==+===+=+=+=+=+
+  | F1  | 0x0B | ESC O P   | ESC O P | ESC [ 1 1 ~ | ESC [ [ A   | ESC 
[ M |
+  | F2  | 0x0C | ESC O Q   | ESC O Q | ESC [ 1 2 ~ | ESC [ [ B   | ESC 
[ N |
+  | F3  |