From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: zhichao.gao@intel.com) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by groups.io with SMTP; Wed, 25 Sep 2019 17:51:23 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2019 17:51:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,549,1559545200"; d="scan'208";a="189842788" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga007.fm.intel.com with ESMTP; 25 Sep 2019 17:51:21 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 25 Sep 2019 17:51:21 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.92]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.140]) with mapi id 14.03.0439.000; Thu, 26 Sep 2019 08:51:19 +0800 From: "Gao, Zhichao" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Wu, Hao A" , "Gao, Liming" Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/TerminalDxe: Enhance the arrow keys support Thread-Topic: [edk2-devel] [PATCH] MdeModulePkg/TerminalDxe: Enhance the arrow keys support Thread-Index: AQHVc5rEL7Ode9un70Wqj9qVpjaAo6c8sizQgABnKKA= Date: Thu, 26 Sep 2019 00:51:19 +0000 Message-ID: <3CE959C139B4C44DBEA1810E3AA6F9000B83F027@SHSMSX101.ccr.corp.intel.com> References: <20190925120925.12600-1-zhichao.gao@intel.com> <734D49CCEBEEF84792F5B80ED585239D5C2F1BE6@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C2F1BE6@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: zhichao.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Ni, Ray > Sent: Thursday, September 26, 2019 2:17 AM > To: devel@edk2.groups.io; Gao, Zhichao > Cc: Wang, Jian J ; Wu, Hao A = ; > Gao, Liming > Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/TerminalDxe: Enhance > the arrow keys support >=20 > Zhichao, > The four new modes you newly added are supported by putty. But I do not > think Putty is the standard the terminal driver needs to follow. > So, > 1. can you please remove the "putty" from the comments (maybe code)? Unfortunately, the terminal type doesn't have a spec or document except Pu= tty's website. That's why I add it to the comment. > 2. can you please find the sources where each mode is defined and double > check whether the change you make is following the mode definition? It > avoids you make Putty happy but make other good-behavior terminal > software unhappy. The normal mode and application mode the Putty's own mode for the cursor k= eys, such as arrow keys. There are *no such modes* in the terminal driver. = So I add the patch to support them all. The special keys usually send a sequence keys, such as ESC + [ + A, thru t= he terminal ConIn. And it is terminal DXE driver's duty to recognize these = sequence keys and transfer the actual key value. Different terminal softwar= e may have different sequence keys for the special keys, but It would be ig= nored if we don't add the support. The only affected thing is that if you input a sequence of keys quickly, s= uch as ESC + [ + A or ESC + O + A, thru the terminal software, then it woul= d be seen as arrow key 'UP' regardless of the terminal type. Same to other = new arrow keys. I made a mistake in the previous patch to add the new terminal types. I re= move the VT100Plus's arrow key function incorrectly and that make the arrow= key not work with the terminal type VT100Plus. And then I think it is bett= er to add the whole support of arrow key. Thanks, Zhichao >=20 > Thanks, > Ray >=20 > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Gao, > > Zhichao > > Sent: Wednesday, September 25, 2019 5:09 AM > > To: devel@edk2.groups.io > > Cc: Wang, Jian J ; Wu, Hao A > > ; Ni, Ray ; Gao, Liming > > > > Subject: [edk2-devel] [PATCH] MdeModulePkg/TerminalDxe: Enhance the > > arrow keys support > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2219 > > > > Refer to > > https://www.ssh.com/ssh/putty/putty- > manuals/0.68/Chapter4.html#config- > > appcursor In normal mode, arrow key would send ESC [A through to ESC > > [D. > > In application mode, arrow key would send ESC OA through to ESC OD. > > > > Cc: Jian J Wang > > Cc: Hao A Wu > > Cc: Ray Ni > > Cc: Liming Gao > > Signed-off-by: Zhichao Gao > > --- > > .../Console/TerminalDxe/TerminalConIn.c | 46 ++++++++++++++++--= - > > 1 file changed, 40 insertions(+), 6 deletions(-) > > > > diff --git > > a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c > > b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c > > index ac31f27984..fdb1a0f1ef 100644 > > --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c > > +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c > > @@ -1402,10 +1402,7 @@ UnicodeToEfiKey ( > > continue; > > } > > > > - if (UnicodeChar =3D=3D 'O' && (TerminalDevice->TerminalType =3D= = =3D > TerminalTypeVt100 || > > - TerminalDevice->TerminalType =3D=3D = TerminalTypeTtyTerm > || > > - TerminalDevice->TerminalType =3D=3D = TerminalTypeXtermR6 > || > > - TerminalDevice->TerminalType =3D=3D > TerminalTypeVt100Plus)) { > > + if (UnicodeChar =3D=3D 'O') { > > TerminalDevice->InputState |=3D INPUT_STATE_O; > > TerminalDevice->ResetState =3D RESET_STATE_DEFAULT; > > continue; > > @@ -1631,6 +1628,35 @@ UnicodeToEfiKey ( > > } > > } > > > > + // > > + // In Putty application mode, the arrow keys would send > > + // ESC OA through to ESC OD > > + // > > + 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 TerminalTypeLinux |= | > > + TerminalDevice->TerminalType =3D=3D TerminalTypeXtermR6 |= | > > + TerminalDevice->TerminalType =3D=3D TerminalTypeVt400 |= | > > + TerminalDevice->TerminalType =3D=3D TerminalTypeSCO) { > > + switch (UnicodeChar) { > > + case 'A': > > + Key.ScanCode =3D SCAN_UP; > > + break; > > + case 'B': > > + Key.ScanCode =3D SCAN_DOWN; > > + break; > > + case 'C': > > + Key.ScanCode =3D SCAN_RIGHT; > > + break; > > + case 'D': > > + Key.ScanCode =3D SCAN_LEFT; > > + break; > > + } > > + } > > + > > if (Key.ScanCode !=3D SCAN_NULL) { > > Key.UnicodeChar =3D 0; > > EfiKeyFiFoInsertOneKey (TerminalDevice, &Key); @@ -1668,10 > > +1694,18 @@ UnicodeToEfiKey ( > > > > Key.ScanCode =3D SCAN_NULL; > > > > + // > > + // In Putty normal mode, the arrow keys would send > > + // ESC [A through to [D > > + // > > if (TerminalDevice->TerminalType =3D=3D TerminalTypePcAnsi |= | > > TerminalDevice->TerminalType =3D=3D TerminalTypeVt100 |= | > > - TerminalDevice->TerminalType =3D=3D TerminalTypeVtUtf8 || > > - TerminalDevice->TerminalType =3D=3D TerminalTypeTtyTerm || > > + TerminalDevice->TerminalType =3D=3D TerminalTypeVt100Plus |= | > > + TerminalDevice->TerminalType =3D=3D TerminalTypeVtUtf8 |= | > > + TerminalDevice->TerminalType =3D=3D TerminalTypeTtyTerm |= | > > + TerminalDevice->TerminalType =3D=3D TerminalTypeLinux |= | > > + TerminalDevice->TerminalType =3D=3D TerminalTypeXtermR6 |= | > > + TerminalDevice->TerminalType =3D=3D TerminalTypeVt400 |= | > > TerminalDevice->TerminalType =3D=3D TerminalTypeSCO) { > > switch (UnicodeChar) { > > case 'A': > > -- > > 2.21.0.windows.1 > > > > > >=20