From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: ray.ni@intel.com) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by groups.io with SMTP; Sun, 22 Sep 2019 19:36:13 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Sep 2019 19:36:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,538,1559545200"; d="scan'208";a="203028511" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga001.fm.intel.com with ESMTP; 22 Sep 2019 19:36:13 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 22 Sep 2019 19:36:12 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.32]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.146]) with mapi id 14.03.0439.000; Mon, 23 Sep 2019 10:36:10 +0800 From: "Ni, Ray" To: "Gao, Zhichao" , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Wu, Hao A" , "Gao, Liming" Subject: Re: [PATCH V3 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types Thread-Topic: [PATCH V3 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types Thread-Index: AQHVbeK0HhDQxadV6kqL2ilemIR5Hac4k3ZA Date: Mon, 23 Sep 2019 02:36:10 +0000 Deferred-Delivery: Mon, 23 Sep 2019 02:36:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C2EBEED@SHSMSX104.ccr.corp.intel.com> References: <20190918053355.19892-1-zhichao.gao@intel.com> <20190918053355.19892-3-zhichao.gao@intel.com> In-Reply-To: <20190918053355.19892-3-zhichao.gao@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTU2OTZjNjYtY2NiZi00NjE2LWIxOTYtMmUxZjU5ODkxMDMwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiXC83NXlcL1E3aGRVMHFHQWZLenpMZGpJK0FhYTlpT0N2TGtKOVdwSzFxSmRFb2kxSDR6UmJQT3hBS3RPU1QwdGxKIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: Gao, Zhichao > Sent: Tuesday, September 17, 2019 10:34 PM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Wu, Hao A ;= Ni, Ray ; Gao, Liming > > Subject: [PATCH V3 2/3] MdeModulePkg/TerminalDxe: Extend the terminal con= sole support types >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2186 >=20 > Extend the support types of terminal console driver. New added types > are Linux, XtermR6, VT400 and SCO. >=20 > Refer to > https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-fun= keys >=20 > Add the missing VT100+ function keys map. >=20 > Add F1-F12 function keys map for Linux, XtermR6, VT400 and SCO. >=20 > 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 | 282 ++++++++++++++++-- > .../Console/TerminalDxe/TerminalConOut.c | 4 + > .../Console/TerminalDxe/TerminalDxe.inf | 6 +- > 5 files changed, 320 insertions(+), 26 deletions(-) >=20 > 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 Protoc= ol and > Simple Text Output Protocol upon Serial IO Protocol. >=20 > -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 >=20 > **/ > @@ -28,7 +28,11 @@ EFI_GUID *mTerminalType[] =3D { > &gEfiVT100Guid, > &gEfiVT100PlusGuid, > &gEfiVTUTF8Guid, > - &gEfiTtyTermGuid > + &gEfiTtyTermGuid, > + &gEdkiiLinuxTermGuid, > + &gEdkiiXtermR6Guid, > + &gEdkiiVT400Guid, > + &gEdkiiSCOTermGuid > }; >=20 >=20 > @@ -37,7 +41,11 @@ CHAR16 *mSerialConsoleNames[] =3D { > 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" > }; >=20 > TERMINAL_DEV mTerminalDevTemplate =3D { > @@ -187,7 +195,8 @@ TerminalDriverBindingSupported ( >=20 > } > // > - // only supports PC ANSI, VT100, VT100+, VT-UTF8, and TtyTerm term= inal types > + // only supports PC ANSI, VT100, VT100+, VT-UTF8, TtyTerm > + // Linux, XtermR6, VT400 and SCO terminal types > // > if (TerminalTypeFromGuid (&Node->Guid) =3D=3D ARRAY_SIZE (mTermina= lType)) { > 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. >=20 > -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 >=20 > @@ -81,7 +81,11 @@ typedef enum { > TerminalTypeVt100, > TerminalTypeVt100Plus, > TerminalTypeVtUtf8, > - TerminalTypeTtyTerm > + TerminalTypeTtyTerm, > + TerminalTypeLinux, > + TerminalTypeXtermR6, > + TerminalTypeVt400, > + TerminalTypeSCO > } TERMINAL_TYPE; >=20 > 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 >=20 > #define RESET_STATE_DEFAULT 0x00 > #define RESET_STATE_ESC_R 0x01 > @@ -848,7 +854,8 @@ TerminalRemoveConsoleDevVariable ( > /** > Build termial device path according to terminal type. >=20 > - @param TerminalType The terminal type is PC ANSI, VT100, VT= 100+ or VT-UTF8. > + @param TerminalType The terminal type is PC ANSI, VT100, VT= 100+, VT-UTF8, TTY-Term, > + Linux, XtermR6, VT400 and SCO. > @param ParentDevicePath Parent device path. > @param TerminalDevicePath Returned terminal device path, if build= ing successfully. >=20 > @@ -1209,6 +1216,28 @@ AnsiRawDataToUnicode ( > | F12 | 0x16 | | ESC @ | | > +=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ >=20 > +Putty function key map: > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D= =3D=3D=3D=3D+ > + | | EFI | | | | = | | > + | | Scan | | | Normal | = | | > + | KEY | Code | VT100+ | Xterm R6 | VT400 | Linux = | SCO | > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D= =3D=3D=3D=3D+ > + | 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 | > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D= =3D=3D=3D=3D+ > + > + > Special Mappings > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > ESC R ESC r ESC R =3D 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. >=20 > (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
> -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 >=20 > @@ -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 @ | | > +=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ >=20 > +Putty function key map: > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D= =3D=3D=3D=3D+ > + | | EFI | | | | = | | > + | | Scan | | | Normal | = | | > + | KEY | Code | VT100+ | Xterm R6 | VT400 | Linux = | SCO | > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D= =3D=3D=3D=3D+ > + | 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 | > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D= =3D=3D=3D=3D+ > + > Special Mappings > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > ESC R ESC r ESC R =3D Reset System > @@ -1378,7 +1403,9 @@ UnicodeToEfiKey ( > } >=20 > if (UnicodeChar =3D=3D 'O' && (TerminalDevice->TerminalType =3D=3D= TerminalTypeVt100 || > - TerminalDevice->TerminalType =3D=3D Ter= minalTypeTtyTerm)) { > + TerminalDevice->TerminalType =3D=3D Ter= minalTypeTtyTerm || > + TerminalDevice->TerminalType =3D=3D Ter= minalTypeXtermR6 || > + TerminalDevice->TerminalType =3D=3D Ter= minalTypeVt100Plus)) { > TerminalDevice->InputState |=3D INPUT_STATE_O; > TerminalDevice->ResetState =3D RESET_STATE_DEFAULT; > continue; > @@ -1548,6 +1575,60 @@ UnicodeToEfiKey ( > Key.ScanCode =3D SCAN_END; > break; > } > + } else if (TerminalDevice->TerminalType =3D=3D TerminalTypeVt100Pl= us) { > + switch (UnicodeChar) { > + case 'P': > + Key.ScanCode =3D SCAN_F1; > + break; > + case 'Q': > + Key.ScanCode =3D SCAN_F2; > + break; > + case 'R': > + Key.ScanCode =3D SCAN_F3; > + break; > + case 'S': > + Key.ScanCode =3D SCAN_F4; > + break; > + case 'T': > + Key.ScanCode =3D SCAN_F5; > + break; > + case 'U': > + Key.ScanCode =3D SCAN_F6; > + break; > + case 'V': > + Key.ScanCode =3D SCAN_F7; > + break; > + case 'W': > + Key.ScanCode =3D SCAN_F8; > + break; > + case 'X': > + Key.ScanCode =3D SCAN_F9; > + break; > + case 'Y': > + Key.ScanCode =3D SCAN_F10; > + break; > + case 'Z': > + Key.ScanCode =3D SCAN_F11; > + break; > + case '[': > + Key.ScanCode =3D SCAN_F12; > + break; > + } > + } else if (TerminalDevice->TerminalType =3D=3D TerminalTypeXtermR6= ) { > + switch (UnicodeChar) { > + case 'P': > + Key.ScanCode =3D SCAN_F1; > + break; > + case 'Q': > + Key.ScanCode =3D SCAN_F2; > + break; > + case 'R': > + Key.ScanCode =3D SCAN_F3; > + break; > + case 'S': > + Key.ScanCode =3D SCAN_F4; > + break; > + } > } >=20 > if (Key.ScanCode !=3D SCAN_NULL) { > @@ -1564,15 +1645,34 @@ UnicodeToEfiKey ( >=20 > case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET: >=20 > + if (UnicodeChar =3D=3D '1' && (TerminalDevice->TerminalType =3D=3D= TerminalTypeXtermR6 || > + TerminalDevice->TerminalType =3D=3D Te= rminalTypeVt400 || > + TerminalDevice->TerminalType =3D=3D Te= rminalTypeLinux)) { > + TerminalDevice->InputState |=3D INPUT_STATE_1; > + continue; > + } > + > + if (UnicodeChar =3D=3D '2' && (TerminalDevice->TerminalType =3D=3D= TerminalTypeXtermR6 || > + TerminalDevice->TerminalType =3D=3D Te= rminalTypeVt400 || > + TerminalDevice->TerminalType =3D=3D Te= rminalTypeLinux)) { > + TerminalDevice->InputState |=3D INPUT_STATE_2; > + continue; > + } > + > + if (UnicodeChar =3D=3D LEFTOPENBRACKET && TerminalDevice->Terminal= Type =3D=3D TerminalTypeLinux) { > + TerminalDevice->InputState |=3D INPUT_STATE_LEFTOPENBRACKET_2ND; > + continue; > + } > + > TerminalDevice->ResetState =3D RESET_STATE_DEFAULT; >=20 > Key.ScanCode =3D SCAN_NULL; >=20 > if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi || > TerminalDevice->TerminalType =3D=3D TerminalTypeVt100 || > - TerminalDevice->TerminalType =3D=3D TerminalTypeVt100Plus || > - TerminalDevice->TerminalType =3D=3D TerminalTypeVtUtf8 || > - TerminalDevice->TerminalType =3D=3D TerminalTypeTtyTerm) { > + TerminalDevice->TerminalType =3D=3D TerminalTypeVtUtf8 || > + TerminalDevice->TerminalType =3D=3D TerminalTypeTtyTerm || > + TerminalDevice->TerminalType =3D=3D TerminalTypeSCO) { > switch (UnicodeChar) { > case 'A': > Key.ScanCode =3D SCAN_UP; > @@ -1614,12 +1714,15 @@ UnicodeToEfiKey ( > case 'X': > if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi) { > Key.ScanCode =3D SCAN_DELETE; > + } else if (TerminalDevice->TerminalType =3D=3D TerminalTypeSCO= ) { > + Key.ScanCode =3D SCAN_F12; > } > break; > case 'P': > if (TerminalDevice->TerminalType =3D=3D TerminalTypeVt100) { > Key.ScanCode =3D SCAN_DELETE; > - } else if (TerminalDevice->TerminalType =3D=3D TerminalTypePcA= nsi) { > + } else if (TerminalDevice->TerminalType =3D=3D TerminalTypePcA= nsi || > + TerminalDevice->TerminalType =3D=3D TerminalTypeSC= O) { > Key.ScanCode =3D SCAN_F4; > } > break; > @@ -1629,7 +1732,8 @@ UnicodeToEfiKey ( > } > break; > case 'V': > - if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi) { > + if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi || > + TerminalDevice->TerminalType =3D=3D TerminalTypeSCO) { > Key.ScanCode =3D SCAN_F10; > } > break; > @@ -1644,7 +1748,8 @@ UnicodeToEfiKey ( > } > break; > case 'U': > - if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi) { > + if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi || > + TerminalDevice->TerminalType =3D=3D TerminalTypeSCO) { > Key.ScanCode =3D SCAN_F9; > } > break; > @@ -1654,40 +1759,52 @@ UnicodeToEfiKey ( > } > break; > case 'M': > - if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi) { > + if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi || > + TerminalDevice->TerminalType =3D=3D TerminalTypeSCO) { > Key.ScanCode =3D SCAN_F1; > } > break; > case 'N': > - if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi) { > + if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi || > + TerminalDevice->TerminalType =3D=3D TerminalTypeSCO) { > Key.ScanCode =3D SCAN_F2; > } > break; > case 'O': > - if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi) { > + if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi || > + TerminalDevice->TerminalType =3D=3D TerminalTypeSCO) { > Key.ScanCode =3D SCAN_F3; > } > break; > case 'Q': > - if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi) { > + if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi || > + TerminalDevice->TerminalType =3D=3D TerminalTypeSCO) { > Key.ScanCode =3D SCAN_F5; > } > break; > case 'R': > - if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi) { > + if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi || > + TerminalDevice->TerminalType =3D=3D TerminalTypeSCO) { > Key.ScanCode =3D SCAN_F6; > } > break; > case 'S': > - if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi) { > + if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi || > + TerminalDevice->TerminalType =3D=3D TerminalTypeSCO) { > Key.ScanCode =3D SCAN_F7; > } > break; > case 'T': > - if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi) { > + if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi || > + TerminalDevice->TerminalType =3D=3D TerminalTypeSCO) { > Key.ScanCode =3D SCAN_F8; > } > break; > + case 'W': > + if (TerminalDevice->TerminalType =3D=3D TerminalTypeSCO) { > + Key.ScanCode =3D SCAN_F11; > + } > + break; > default : > break; > } > @@ -1704,10 +1821,105 @@ UnicodeToEfiKey ( > UnicodeChar <=3D '9') { > TerminalDevice->TtyEscapeStr[0] =3D UnicodeChar; > TerminalDevice->TtyEscapeIndex =3D 1; > - TerminalDevice->InputState |=3D INPUT_STATE_LEFTOPENBRACKET_2; > + TerminalDevice->InputState |=3D INPUT_STATE_LEFTOPENBRACKET_TTY; > + continue; > + } > + > + if (Key.ScanCode !=3D SCAN_NULL) { > + Key.UnicodeChar =3D 0; > + EfiKeyFiFoInsertOneKey (TerminalDevice, &Key); > + TerminalDevice->InputState =3D INPUT_STATE_DEFAULT; > + UnicodeToEfiKeyFlushState (TerminalDevice); > + continue; > + } > + > + UnicodeToEfiKeyFlushState (TerminalDevice); > + > + break; > + > + case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET | INPUT_STATE_1: > + > + TerminalDevice->ResetState =3D RESET_STATE_DEFAULT; > + > + Key.ScanCode =3D SCAN_NULL; > + > + if (TerminalDevice->TerminalType =3D=3D TerminalTypeXtermR6 || > + TerminalDevice->TerminalType =3D=3D TerminalTypeVt400 || > + TerminalDevice->TerminalType =3D=3D TerminalTypeLinux) { > + switch (UnicodeChar) { > + case '1': > + if (TerminalDevice->TerminalType =3D=3D TerminalTypeVt400) { > + Key.ScanCode =3D SCAN_F1; > + } > + break; > + case '2': > + if (TerminalDevice->TerminalType =3D=3D TerminalTypeVt400) { > + Key.ScanCode =3D SCAN_F2; > + } > + break; > + case '3': > + if (TerminalDevice->TerminalType =3D=3D TerminalTypeVt400) { > + Key.ScanCode =3D SCAN_F3; > + } > + break; > + case '4': > + if (TerminalDevice->TerminalType =3D=3D TerminalTypeVt400) { > + Key.ScanCode =3D SCAN_F4; > + } > + break; > + case '5': > + if (TerminalDevice->TerminalType =3D=3D TerminalTypeXtermR6 || > + TerminalDevice->TerminalType =3D=3D TerminalTypeVt400) { > + Key.ScanCode =3D SCAN_F5; > + } > + break; > + case '7': > + Key.ScanCode =3D SCAN_F6; > + break; > + case '8': > + Key.ScanCode =3D SCAN_F7; > + break; > + case '9': > + Key.ScanCode =3D SCAN_F8; > + break; > + } > + } > + > + if (Key.ScanCode !=3D SCAN_NULL) { > + Key.UnicodeChar =3D 0; > + EfiKeyFiFoInsertOneKey (TerminalDevice, &Key); > + TerminalDevice->InputState =3D INPUT_STATE_DEFAULT; > + UnicodeToEfiKeyFlushState (TerminalDevice); > continue; > } >=20 > + UnicodeToEfiKeyFlushState (TerminalDevice); > + > + break; > + > + case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET | INPUT_STATE_2: > + > + TerminalDevice->InputState =3D INPUT_STATE_DEFAULT; > + Key.ScanCode =3D SCAN_NULL; > + if (TerminalDevice->TerminalType =3D=3D TerminalTypeXtermR6 || > + TerminalDevice->TerminalType =3D=3D TerminalTypeVt400 || > + TerminalDevice->TerminalType =3D=3D TerminalTypeLinux) { > + switch (UnicodeChar) { > + case '0': > + Key.ScanCode =3D SCAN_F9; > + break; > + case '1': > + Key.ScanCode =3D SCAN_F10; > + break; > + case '3': > + Key.ScanCode =3D SCAN_F11; > + break; > + case '4': > + Key.ScanCode =3D SCAN_F12; > + break; > + } > + } > + > if (Key.ScanCode !=3D SCAN_NULL) { > Key.UnicodeChar =3D 0; > EfiKeyFiFoInsertOneKey (TerminalDevice, &Key); > @@ -1720,8 +1932,44 @@ UnicodeToEfiKey ( >=20 > break; >=20 > + case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET | INPUT_STATE_LEF= TOPENBRACKET_2ND: > + > + TerminalDevice->InputState =3D INPUT_STATE_DEFAULT; > + Key.ScanCode =3D SCAN_NULL; > + > + if (TerminalDevice->TerminalType =3D=3D TerminalTypeLinux) { > + switch (UnicodeChar) { > + case 'A': > + Key.ScanCode =3D SCAN_F1; > + break; > + case 'B': > + Key.ScanCode =3D SCAN_F2; > + break; > + case 'C': > + Key.ScanCode =3D SCAN_F3; > + break; > + case 'D': > + Key.ScanCode =3D SCAN_F4; > + break; > + case 'E': > + Key.ScanCode =3D SCAN_F5; > + break; > + } > + } > + > + if (Key.ScanCode !=3D SCAN_NULL) { > + Key.UnicodeChar =3D 0; > + EfiKeyFiFoInsertOneKey (TerminalDevice, &Key); > + TerminalDevice->InputState =3D INPUT_STATE_DEFAULT; > + UnicodeToEfiKeyFlushState (TerminalDevice); > + continue; > + } > + > + UnicodeToEfiKeyFlushState (TerminalDevice); > + > + break; >=20 > - case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET | INPUT_STATE_LEF= TOPENBRACKET_2: > + case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET | INPUT_STATE_LEF= TOPENBRACKET_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: >=20 > if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiCh= ar)) { > // > 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 h= otplug serial > # devices. > # > -# 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 > # > # > @@ -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 >=20 > [Protocols] > -- > 2.21.0.windows.1