From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) by mx.groups.io with SMTP id smtpd.web12.8979.1585306870218951894 for ; Fri, 27 Mar 2020 04:01:12 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@protonmail.com header.s=default header.b=oaNrfPyQ; spf=pass (domain: protonmail.com, ip: 185.70.40.134, mailfrom: vit9696@protonmail.com) Date: Fri, 27 Mar 2020 11:00:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=default; t=1585306867; bh=nCtKhF+FfZLav3HJFuP4FLLQmHBM7oAHcx664Pcs1Ro=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=oaNrfPyQ9DxvQJZ73O/6zn9Ad/lI3A9G3ZTEDJM/dZ8ZUetEYOd4gRlkcCD4pTnq1 cbWtrLQkb9SPda5ezog26xiVAYpjzBsYYB1KkD7/cJFcKY9SnVTbKdbfA0iOC7uzT7 3AHLydAhq4Ex/7avU4n8oRkUOkQXLeLPFbclsWvQ= To: "Gao, Zhichao" From: "Vitaly Cheptsov" Cc: "devel@edk2.groups.io" , Andrew Fish , Laszlo Ersek , =?UTF-8?Q?Marvin_H=C3=A4user?= , Mike Kinney , "Ni, Ray" Reply-To: vit9696 Subject: Re: [edk2-devel] [PATCH 1/1] ShellPkg: Add support for input with separately reported modifiers Message-ID: <102EE286-A081-48D5-93FC-C1AB769B8D74@protonmail.com> In-Reply-To: References: <20200210101811.18741-1-vit9696@protonmail.com> <20200210101811.18741-2-vit9696@protonmail.com> <_jqgwA58_jl6HqFJk6lb67C9nen1mEqrh_RbxOocaKH0G8J_QZ8mfAclsDvO-RcRB9YcmAtX8kNh2VJsFdPM9dTpvOgajbjZNKxsiOwGrBQ=@protonmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.7 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT,HTML_MESSAGE shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mail.protonmail.ch X-Groupsio-MsgNum: 56483 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha256; boundary="---------------------8af2c860d84f4373c04fdf648f295e5f"; charset=UTF-8 -----------------------8af2c860d84f4373c04fdf648f295e5f Cc: "devel@edk2.groups.io" , Andrew Fish , Laszlo Ersek , =?utf-8?Q?Marvin_H=C3=A4user?= , Mike Kinney , "Ni, Ray" Content-Type: multipart/alternative; boundary="Apple-Mail=_FD783D43-18E3-4F71-956E-A0D3B250A842" Date: Fri, 27 Mar 2020 14:00:53 +0300 From: vit9696 In-Reply-To: Message-Id: <102EE286-A081-48D5-93FC-C1AB769B8D74@protonmail.com> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) References: <20200210101811.18741-1-vit9696@protonmail.com> <20200210101811.18741-2-vit9696@protonmail.com> <_jqgwA58_jl6HqFJk6lb67C9nen1mEqrh_RbxOocaKH0G8J_QZ8mfAclsDvO-RcRB9YcmAtX8kNh2VJsFdPM9dTpvOgajbjZNKxsiOwGrBQ=@protonmail.com> <74Aq9y53Vum6ZvjqZLV3Mw-BNr6b8P2nJsH64WK1Kfi1Yt8hqNmAKcZuPoo-njPKz9MSEgNuTLCKF5xW4lXFEQ==@protonmail.conversationid> Subject: Re: [edk2-devel] [PATCH 1/1] ShellPkg: Add support for input with separately reported modifiers To: "Gao, Zhichao" X-Mailer: Apple Mail (2.3608.80.23.2.2) --Apple-Mail=_FD783D43-18E3-4F71-956E-A0D3B250A842 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hello, Requesting to merge this into edk2-stable202005 for the reasons explained i= n BZ[1]. I assume there is no real objection for this, only the approach we= make such changes in the future, but this can be postponed as we encounter= more of such problems. Best regards, Vitaly [1] https://bugzilla.tianocore.org/show_bug.cgi?id=3D2510 > 20 =D1=84=D0=B5=D0=B2=D1=80. 2020 =D0=B3., =D0=B2 03:27, Gao, Zhichao =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0): >=20 > Sorry for my mistake. Then I have no other comments for this patch. > Reviewed-by: Zhichao Gao > > =20 > Thanks, > Zhichao > =20 > <>From: vit9696 =20 > Sent: Wednesday, February 19, 2020 8:15 PM > To: Gao, Zhichao ; devel@edk2.groups.io > Subject: RE: [edk2-devel] [PATCH 1/1] ShellPkg: Add support for input wit= h separately reported modifiers > =20 > Zhichao, > =20 > Thanks for your review. The comment is correct, as ShiftOnlyState means t= he state where only shift (and no other modifiers) can be pressed or not. > =20 > Best wishes, > Vitaly > =20 > On Wed, Feb 19, 2020 at 09:55, Gao, Zhichao > wrote: > Hi Vitaly, >=20 > See the comment below: >=20 > > -----Original Message----- > > From: devel@edk2.groups.io > On Behalf Of Vitaly > > Cheptsov via Groups.Io > > Sent: Monday, February 10, 2020 6:18 PM > > To: devel@edk2.groups.io > > Subject: [edk2-devel] [PATCH 1/1] ShellPkg: Add support for input with > > separately reported modifiers > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2510 > > > > Some firmwares: > > - Report Shift modifier even when they report upper-case unicode letter= . > > - Report Ctrl modifier with "shifted" UniChar (i.e. X - 'A' + 1). > > > > This change provides support for these firmwares preserving the compati= bility > > with the previous input handling. > > > > Signed-off-by: Michael Belyaev > > > Reviewed-by: Vitaly Cheptsov > > > --- > > ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c | 37 > > ++++++++++++++------ > > ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c | 28 > > ++++++++++----- > > ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c | 6 ++++ > > ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c | 1= 1 > > +++--- > > 4 files changed, 58 insertions(+), 24 deletions(-) > > > > diff --git > > a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c > > b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c > > index df530f1119..9615a4dfbd 100644 > > --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c > > +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c > > @@ -1381,8 +1381,8 @@ MainCommandDisplayHelp ( > > continue; > > } > > > > - if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) =3D=3D = 0) || > > - (KeyData.KeyState.KeyShiftState =3D=3D EFI_SHIFT_STATE_VALID)) { > > + if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) =3D=3D = 0) > > + || (KeyData.KeyState.KeyShiftState =3D=3D EFI_SHIFT_STATE_VALID)) { > > // > > // For consoles that don't support/report shift state, > > // CTRL+W is translated to L'W' - L'A' + 1. > > @@ -1390,14 +1390,17 @@ MainCommandDisplayHelp ( > > if (KeyData.Key.UnicodeChar =3D=3D L'W' - L'A' + 1) { > > break; > > } > > - } else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) = !=3D 0) > > && > > - ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | > > EFI_RIGHT_CONTROL_PRESSED)) !=3D 0) && > > - ((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | > > EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) =3D=3D 0)) { > > + } else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) = !=3D 0) > > + && ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | > > EFI_RIGHT_CONTROL_PRESSED)) !=3D 0) > > + && ((KeyData.KeyState.KeyShiftState & > > + ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | > > + EFI_RIGHT_CONTROL_PRESSED)) =3D=3D 0)) { > > // > > // For consoles that supports/reports shift state, > > // make sure that only CONTROL shift key is pressed. > > + // For some consoles that report shift state, > > + // CTRL+W is still translated to L'W' - L'A' + 1. > > // > > - if ((KeyData.Key.UnicodeChar =3D=3D 'w') || (KeyData.Key.UnicodeChar = =3D=3D 'W')) > > { > > + if ((KeyData.Key.UnicodeChar =3D=3D L'w') || (KeyData.Key.UnicodeChar= =3D=3D L'W') > > + || (KeyData.Key.UnicodeChar =3D=3D L'w' - L'a' + 1) || > > + (KeyData.Key.UnicodeChar =3D=3D L'W' - L'A' + 1)) { > > break; > > } > > } > > @@ -1834,7 +1837,8 @@ MainEditorKeyInput ( > > EFI_KEY_DATA KeyData; > > EFI_STATUS Status; > > EFI_SIMPLE_POINTER_STATE MouseState; > > - BOOLEAN NoShiftState; > > + BOOLEAN NoModifierState; > > + BOOLEAN ShiftOnlyState; > > > > do { > > > > @@ -1886,17 +1890,28 @@ MainEditorKeyInput ( > > // > > StatusBarSetRefresh(); > > // > > - // NoShiftState: TRUE when no shift key is pressed. > > + // NoModifierState: TRUE when no modifier key is pressed. > > // > > - NoShiftState =3D ((KeyData.KeyState.KeyShiftState & > > EFI_SHIFT_STATE_VALID) =3D=3D 0) || (KeyData.KeyState.KeyShiftState =3D= =3D > > EFI_SHIFT_STATE_VALID); > > + NoModifierState =3D ((KeyData.KeyState.KeyShiftState & > > EFI_SHIFT_STATE_VALID) =3D=3D 0) > > + || (KeyData.KeyState.KeyShiftState =3D=3D EFI_SHIFT_STATE_VALID); > > + // > > + // ShiftOnlyState: TRUE when no modifier key except Shift is pressed. > > + // > > + ShiftOnlyState =3D ((KeyData.KeyState.KeyShiftState & > > EFI_SHIFT_STATE_VALID) =3D=3D 0) > > + || ((KeyData.KeyState.KeyShiftState > > + & ~(EFI_SHIFT_STATE_VALID | > > + EFI_LEFT_SHIFT_PRESSED | EFI_RIGHT_SHIFT_PRESSED)) =3D=3D 0); > > // > > // dispatch to different components' key handling function > > // > > if (EFI_NOT_FOUND !=3D MenuBarDispatchControlHotKey(&KeyData)) { > > Status =3D EFI_SUCCESS; > > - } else if (NoShiftState && ((KeyData.Key.ScanCode =3D=3D SCAN_NULL) |= | > > ((KeyData.Key.ScanCode >=3D SCAN_UP) && (KeyData.Key.ScanCode <=3D > > SCAN_PAGE_DOWN)))) { > > + } else if ((ShiftOnlyState && (KeyData.Key.ScanCode =3D=3D SCAN_NULL)= ) > > + || (NoModifierState && (KeyData.Key.ScanCode >=3D SCAN_UP) && > > (KeyData.Key.ScanCode <=3D SCAN_PAGE_DOWN))) { > > + // > > + // alphanumeric keys with or without shift, or arrow keys without shi= ft > > + // >=20 > This is unmatched with the comments. It only handles the alphanumeric key= s with shift. >=20 > Thanks, > Zhichao >=20 > > Status =3D FileBufferHandleInput (&KeyData.Key); > > - } else if (NoShiftState && (KeyData.Key.ScanCode >=3D SCAN_F1) && > > (KeyData.Key.ScanCode <=3D SCAN_F12)) { > > + } else if (NoModifierState && (KeyData.Key.ScanCode >=3D SCAN_F1) > > + && (KeyData.Key.ScanCode <=3D SCAN_F12)) { > > Status =3D MenuBarDispatchFunctionKey (&KeyData.Key); > > } else { > > StatusBarSetStatusString (L"Unknown Command"); diff --git > > a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c > > b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c > > index 35b0b701e8..d053059220 100644 > > --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c > > +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c > > @@ -130,6 +130,8 @@ InputBarRefresh ( > > UINTN EventIndex; > > UINTN CursorRow; > > UINTN CursorCol; > > + BOOLEAN ShiftPressed; > > + BOOLEAN ModifiersPressed; > > > > // > > // variable initialization > > @@ -180,17 +182,23 @@ InputBarRefresh ( > > if (EFI_ERROR (Status)) { > > continue; > > } > > - if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) !=3D 0)= && > > - (KeyData.KeyState.KeyShiftState !=3D EFI_SHIFT_STATE_VALID)) { > > - // > > - // Shift key pressed. > > - // > > + ModifiersPressed =3D ((KeyData.KeyState.KeyShiftState & > > EFI_SHIFT_STATE_VALID) !=3D 0) > > + && (KeyData.KeyState.KeyShiftState !=3D > > + EFI_SHIFT_STATE_VALID); > > + > > + // > > + // TRUE if Shift is pressed and no other modifiers are pressed > > + // > > + ShiftPressed =3D ModifiersPressed && > > + ((KeyData.KeyState.KeyShiftState & > > + ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_SHIFT_PRESSED | > > + EFI_RIGHT_SHIFT_PRESSED)) =3D=3D 0); > > + > > + if (ModifiersPressed && !ShiftPressed) { > > continue; > > } > > // > > // pressed ESC > > // > > - if (KeyData.Key.ScanCode =3D=3D SCAN_ESC) { > > + if (!ModifiersPressed && KeyData.Key.ScanCode =3D=3D SCAN_ESC) { > > Size =3D 0; > > Status =3D EFI_NOT_READY; > > break; > > @@ -198,9 +206,10 @@ InputBarRefresh ( > > // > > // return pressed > > // > > - if (KeyData.Key.UnicodeChar =3D=3D CHAR_LINEFEED || > > KeyData.Key.UnicodeChar =3D=3D CHAR_CARRIAGE_RETURN) { > > + if (!ModifiersPressed > > + && (KeyData.Key.UnicodeChar =3D=3D CHAR_LINEFEED || > > + KeyData.Key.UnicodeChar =3D=3D CHAR_CARRIAGE_RETURN)) { > > break; > > - } else if (KeyData.Key.UnicodeChar =3D=3D CHAR_BACKSPACE) { > > + } else if (!ModifiersPressed && KeyData.Key.UnicodeChar =3D=3D > > + CHAR_BACKSPACE) { > > // > > // backspace > > // > > @@ -213,7 +222,8 @@ InputBarRefresh ( > > > > } > > } > > - } else if (KeyData.Key.UnicodeChar <=3D 127 && KeyData.Key.UnicodeCha= r >=3D > > 32) { > > + } else if ((!ModifiersPressed || ShiftPressed) > > + && KeyData.Key.UnicodeChar <=3D 127 && > > + KeyData.Key.UnicodeChar >=3D 32) { > > // > > // VALID ASCII char pressed > > // > > diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c > > b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c > > index ca8bc506d9..eabbf3c571 100644 > > --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c > > +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c > > @@ -190,11 +190,17 @@ MenuBarDispatchControlHotKey ( > > // > > // For consoles that supports/reports shift state, > > // make sure only CONTROL is pressed. > > + // For some consoles that report shift state, > > + // Ctrl+A is still translated to 1 (UnicodeChar). > > // > > if ((KeyData->Key.UnicodeChar >=3D L'A') && (KeyData->Key.UnicodeChar <= =3D > > L'Z')) { > > ControlIndex =3D KeyData->Key.UnicodeChar - L'A' + 1; > > } else if ((KeyData->Key.UnicodeChar >=3D L'a') && (KeyData->Key.Unicod= eChar > > <=3D L'z')) { > > ControlIndex =3D KeyData->Key.UnicodeChar - L'a' + 1; > > + } else if ((KeyData->Key.UnicodeChar >=3D L'A' - L'A' + 1) && (KeyDat= a- > > >Key.UnicodeChar <=3D L'Z' - L'A' + 1)) { > > + ControlIndex =3D KeyData->Key.UnicodeChar; > > + } else if ((KeyData->Key.UnicodeChar >=3D L'a' - L'a' + 1) && (KeyDat= a- > > >Key.UnicodeChar <=3D L'z' - L'z' + 1)) { > > + ControlIndex =3D KeyData->Key.UnicodeChar; > > } > > } > > if ((SCAN_CONTROL_Z < ControlIndex) > > diff --git > > a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c > > b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c > > index a00df49d38..394e531c16 100644 > > --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor= .c > > +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor= . > > +++ c > > @@ -137,14 +137,17 @@ HMainCommandDisplayHelp ( > > if (KeyData.Key.UnicodeChar =3D=3D L'W' - L'A' + 1) { > > break; > > } > > - } else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) = !=3D 0) > > && > > - ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | > > EFI_RIGHT_CONTROL_PRESSED)) !=3D 0) && > > - ((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | > > EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) =3D=3D 0)) { > > + } else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) = !=3D 0) > > + && ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | > > EFI_RIGHT_CONTROL_PRESSED)) !=3D 0) > > + && ((KeyData.KeyState.KeyShiftState & > > + ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | > > + EFI_RIGHT_CONTROL_PRESSED)) =3D=3D 0)) { > > // > > // For consoles that supports/reports shift state, > > // make sure that only CONTROL shift key is pressed. > > + // For some consoles that report shift state, > > + // CTRL+W is still translated to L'W' - L'A' + 1. > > // > > - if ((KeyData.Key.UnicodeChar =3D=3D 'w') || (KeyData.Key.UnicodeChar = =3D=3D 'W')) > > { > > + if ((KeyData.Key.UnicodeChar =3D=3D 'w') || (KeyData.Key.UnicodeChar = =3D=3D 'W') > > + || (KeyData.Key.UnicodeChar =3D=3D L'w' - L'a' + 1) || > > + (KeyData.Key.UnicodeChar =3D=3D L'W' - L'A' + 1)) { > > break; > > } > > } > > -- > > 2.21.1 (Apple Git-122.3) > > > > > > -=3D-=3D-=3D-=3D-=3D-=3D > > Groups.io Links: You receive all messages sent to this group. > > > > View/Reply Online (#54122): https://edk2.groups.io/g/devel/message/5412= 2 > > Mute This Topic: https://groups.io/mt/71133729/1768756 > > Group Owner: devel+owner@edk2.groups.io > > Unsubscribe: https://edk2.groups.io/g/devel/unsub [zhichao.gao@intel.com] > > -=3D-=3D-=3D-=3D-=3D-=3D >=20 --Apple-Mail=_FD783D43-18E3-4F71-956E-A0D3B250A842 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hello,

Requesting to merge this into edk2-stable2= 02005 for the reasons explained in BZ[1]. I assume there is no real ob= jection for this, only the approach we make such changes in the future, but= this can be postponed as we encounter more of such problems.

Best regards,
Vitaly

[1]&= nbsp;https://bugzilla.tianocore.org/show_bug.cgi?id=3D2510

20 =D1=84=D0=B5=D0=B2=D1=80. 2020 =D0=B3., =D0=B2 03:27, Gao, Zhichao= <zhichao.gao@intel.= com> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0):

= Sorry for my mistake. Then I have no other comments for this patch.
Reviewed-by: Zhichao Gao &l= t;zhichao.gao@intel.com>
 
Thanks,
Zhichao
 
From: vit9696 <vit9696@protonmail.com> 
Sent: Wednesday, February 19, 2020 8:= 15 PM
To: Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io
Subj= ect: RE: [edk2-devel]= [PATCH 1/1] ShellPkg: Add support for input with separately reported modif= iers
 
= Zhichao,
 
Thanks for your review. The comment is correct, as Shif= tOnlyState means the state where only shift (and no other modifiers) can be= pressed or not.
 
=
Best wishes,
<= div class=3D"">
Vitaly
 <= /o:p>
On Wed, Feb 19, 2020 at 09:55,= Gao, Zhichao <zhichao.gao@intel.com&g= t; wrote:

Hi Vitaly,
See the comment below:

> -----Original Message-----
> From: devel@= edk2.groups.io <devel@edk2.groups.io> On Behalf Of Vitaly=
> Cheptsov via Groups.Io
> Sent: Monday,= February 10, 2020 6:18 PM
> To: devel@edk2.groups.io<= /a>
> Subject: [edk2-devel] [PATCH 1/1] ShellPkg: Add supp= ort for input with
> separately reported modifiers
>
> REF:&n= bsp;
https://b= ugzilla.tianocore.org/show_bug.cgi?id=3D2510
>
> Some firmwares:
> - Report Shift modifier even= when they report upper-case unicode letter.
> - Report Ct= rl modifier with "shifted" UniChar (i.e. X - 'A' + 1).
>> This change provides support for these firmwares preservi= ng the compatibility
> with the previous input handling.>
> Signed-off-by: Michael Belyaev <usrsse2@icloud.com>
> Revie= wed-by: Vitaly Cheptsov <vit9696@protonma= il.com>
> ---
> ShellPkg/Library/U= efiShellDebug1CommandsLib/Edit/MainTextEditor.c | 37
> +++= +++++++++++------
> ShellPkg/Library/UefiShellDebug1Comman= dsLib/EditInputBar.c | 28
> ++++++++++-----
= > ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c | 6 ++++
> ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHex= Editor.c | 11
> +++---
> 4 files changed,= 58 insertions(+), 24 deletions(-)
>
> di= ff --git
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/E= dit/MainTextEditor.c
> b/ShellPkg/Library/UefiShellDebug1C= ommandsLib/Edit/MainTextEditor.c
> index df530f1119..9615a= 4dfbd 100644
> --- a/ShellPkg/Library/UefiShellDebug1Comma= ndsLib/Edit/MainTextEditor.c
> +++ b/ShellPkg/Library/Uefi= ShellDebug1CommandsLib/Edit/MainTextEditor.c
> @@ -1381,8 = +1381,8 @@ MainCommandDisplayHelp (
> continue;
> }
>
> - if (((KeyData.KeyState= .KeyShiftState & EFI_SHIFT_STATE_VALID) =3D=3D 0) ||
>= - (KeyData.KeyState.KeyShiftState =3D=3D EFI_SHIFT_STATE_VALID)) {
> + if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VA= LID) =3D=3D 0)
> + || (KeyData.KeyState.KeyShiftState =3D= =3D EFI_SHIFT_STATE_VALID)) {
> //
> // F= or consoles that don't support/report shift state,
> // CT= RL+W is translated to L'W' - L'A' + 1.
> @@ -1390,14 +1390= ,17 @@ MainCommandDisplayHelp (
> if (KeyData.Key.UnicodeC= har =3D=3D L'W' - L'A' + 1) {
> break;
> = }
> - } else if (((KeyData.KeyState.KeyShiftState & EF= I_SHIFT_STATE_VALID) !=3D 0)
> &&
&g= t; - ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED |
> EFI_RIGHT_CONTROL_PRESSED)) !=3D 0) &&
> - ((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID |> EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) = =3D=3D 0)) {
> + } else if (((KeyData.KeyState.KeyShiftSta= te & EFI_SHIFT_STATE_VALID) !=3D 0)
> + && ((K= eyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED |
> EFI_RIGHT_CONTROL_PRESSED)) !=3D 0)
> + &&= ((KeyData.KeyState.KeyShiftState &
> + ~(EFI_SHIFT_ST= ATE_VALID | EFI_LEFT_CONTROL_PRESSED |
> + EFI_RIGHT_CONTR= OL_PRESSED)) =3D=3D 0)) {
> //
> // For c= onsoles that supports/reports shift state,
> // make sure = that only CONTROL shift key is pressed.
> + // For some co= nsoles that report shift state,
> + // CTRL+W is still tra= nslated to L'W' - L'A' + 1.
> //
> - if (= (KeyData.Key.UnicodeChar =3D=3D 'w') || (KeyData.Key.UnicodeChar =3D=3D 'W'= ))
> {
> + if ((KeyData.Key.UnicodeChar = =3D=3D L'w') || (KeyData.Key.UnicodeChar =3D=3D L'W')
> + = || (KeyData.Key.UnicodeChar =3D=3D L'w' - L'a' + 1) ||
> += (KeyData.Key.UnicodeChar =3D=3D L'W' - L'A' + 1)) {
> bre= ak;
> }
> }
> @@ -1834,7= +1837,8 @@ MainEditorKeyInput (
> EFI_KEY_DATA KeyData;> EFI_STATUS Status;
> EFI_SIMPLE_POINTER_= STATE MouseState;
> - BOOLEAN NoShiftState;
= > + BOOLEAN NoModifierState;
> + BOOLEAN ShiftOnlyState= ;
>
> do {
>
> @@ -1886,17 +1890,28 @@ MainEditorKeyInput (
> //<= br class=3D"">> StatusBarSetRefresh();
> //
> - // NoShiftState: TRUE when no shift key is pressed.
> + // NoModifierState: TRUE when no modifier key is pressed.
> //
> - NoShiftState =3D ((KeyData.KeyState.KeyS= hiftState &
> EFI_SHIFT_STATE_VALID) =3D=3D 0) || (Key= Data.KeyState.KeyShiftState =3D=3D
> EFI_SHIFT_STATE_VALID= );
> + NoModifierState =3D ((KeyData.KeyState.KeyShiftStat= e &
> EFI_SHIFT_STATE_VALID) =3D=3D 0)
&= gt; + || (KeyData.KeyState.KeyShiftState =3D=3D EFI_SHIFT_STATE_VALID);
> + //
> + // ShiftOnlyState: TRUE when no m= odifier key except Shift is pressed.
> + //
= > + ShiftOnlyState =3D ((KeyData.KeyState.KeyShiftState &
> EFI_SHIFT_STATE_VALID) =3D=3D 0)
> + || ((KeyDa= ta.KeyState.KeyShiftState
> + & ~(EFI_SHIFT_STATE_VALI= D |
> + EFI_LEFT_SHIFT_PRESSED | EFI_RIGHT_SHIFT_PRESSED))= =3D=3D 0);
> //
> // dispatch to differe= nt components' key handling function
> //
&g= t; if (EFI_NOT_FOUND !=3D MenuBarDispatchControlHotKey(&KeyData)) {
> Status =3D EFI_SUCCESS;
> - } else if (NoS= hiftState && ((KeyData.Key.ScanCode =3D=3D SCAN_NULL) ||
> ((KeyData.Key.ScanCode >=3D SCAN_UP) && (KeyData.Key.= ScanCode <=3D
> SCAN_PAGE_DOWN)))) {
>= + } else if ((ShiftOnlyState && (KeyData.Key.ScanCode =3D=3D SCAN_= NULL))
> + || (NoModifierState && (KeyData.Key.Sca= nCode >=3D SCAN_UP) &&
> (KeyData.Key.ScanCode = <=3D SCAN_PAGE_DOWN))) {
> + //
> + //= alphanumeric keys with or without shift, or arrow keys without shift
> + //

This is unmatched with the = comments. It only handles the alphanumeric keys with shift.
<= br class=3D"">Thanks,
Zhichao

&g= t; Status =3D FileBufferHandleInput (&KeyData.Key);
> = - } else if (NoShiftState && (KeyData.Key.ScanCode >=3D SCAN_F1)= &&
> (KeyData.Key.ScanCode <=3D SCAN_F12)) {> + } else if (NoModifierState && (KeyData.Key.Scan= Code >=3D SCAN_F1)
> + && (KeyData.Key.ScanCode= <=3D SCAN_F12)) {
> Status =3D MenuBarDispatchFunction= Key (&KeyData.Key);
> } else {
> Stat= usBarSetStatusString (L"Unknown Command"); diff --git
> a/= ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c
&g= t; b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c
> index 35b0b701e8..d053059220 100644
> --- a/ShellP= kg/Library/UefiShellDebug1CommandsLib/EditInputBar.c
> +++= b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c
> @@ -130,6 +130,8 @@ InputBarRefresh (
> UINTN EventI= ndex;
> UINTN CursorRow;
> UINTN CursorCo= l;
> + BOOLEAN ShiftPressed;
> + BOOLEAN = ModifiersPressed;
>
> //
&g= t; // variable initialization
> @@ -180,17 +182,23 @@ Inpu= tBarRefresh (
> if (EFI_ERROR (Status)) {
&g= t; continue;
> }
> - if (((KeyData.KeySta= te.KeyShiftState & EFI_SHIFT_STATE_VALID) !=3D 0) &&
> - (KeyData.KeyState.KeyShiftState !=3D EFI_SHIFT_STATE_VALID)) {=
> - //
> - // Shift key pressed.
> - //
> + ModifiersPressed =3D ((KeyData.KeySta= te.KeyShiftState &
> EFI_SHIFT_STATE_VALID) !=3D 0)> + && (KeyData.KeyState.KeyShiftState !=3D
> + EFI_SHIFT_STATE_VALID);
> +
>= ; + //
> + // TRUE if Shift is pressed and no other modifi= ers are pressed
> + //
> + ShiftPressed = =3D ModifiersPressed &&
> + ((KeyData.KeyState.Key= ShiftState &
> + ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_SH= IFT_PRESSED |
> + EFI_RIGHT_SHIFT_PRESSED)) =3D=3D 0);
> +
> + if (ModifiersPressed && !Shi= ftPressed) {
> continue;
> }
> //
> // pressed ESC
> //
> - if (KeyData.Key.ScanCode =3D=3D SCAN_ESC) {
>= + if (!ModifiersPressed && KeyData.Key.ScanCode =3D=3D SCAN_ESC) {=
> Size =3D 0;
> Status =3D EFI_NOT_READY= ;
> break;
> @@ -198,9 +206,10 @@ InputBa= rRefresh (
> //
> // return pressed
> //
> - if (KeyData.Key.UnicodeChar =3D=3D CH= AR_LINEFEED ||
> KeyData.Key.UnicodeChar =3D=3D CHAR_CARRI= AGE_RETURN) {
> + if (!ModifiersPressed
>= + && (KeyData.Key.UnicodeChar =3D=3D CHAR_LINEFEED ||
> + KeyData.Key.UnicodeChar =3D=3D CHAR_CARRIAGE_RETURN)) {
> break;
> - } else if (KeyData.Key.UnicodeChar = =3D=3D CHAR_BACKSPACE) {
> + } else if (!ModifiersPressed = && KeyData.Key.UnicodeChar =3D=3D
> + CHAR_BACKSPA= CE) {
> //
> // backspace
&= gt; //
> @@ -213,7 +222,8 @@ InputBarRefresh (
>
> }
> }
> - } el= se if (KeyData.Key.UnicodeChar <=3D 127 && KeyData.Key.UnicodeCh= ar >=3D
> 32) {
> + } else if ((!Modif= iersPressed || ShiftPressed)
> + && KeyData.Key.Un= icodeChar <=3D 127 &&
> + KeyData.Key.UnicodeCh= ar >=3D 32) {
> //
> // VALID ASCII ch= ar pressed
> //
> diff --git a/ShellPkg/L= ibrary/UefiShellDebug1CommandsLib/EditMenuBar.c
> b/ShellP= kg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c
> inde= x ca8bc506d9..eabbf3c571 100644
> --- a/ShellPkg/Library/U= efiShellDebug1CommandsLib/EditMenuBar.c
> +++ b/ShellPkg/L= ibrary/UefiShellDebug1CommandsLib/EditMenuBar.c
> @@ -190,= 11 +190,17 @@ MenuBarDispatchControlHotKey (
> //
> // For consoles that supports/reports shift state,
> // make sure only CONTROL is pressed.
> + // For som= e consoles that report shift state,
> + // Ctrl+A is still= translated to 1 (UnicodeChar).
> //
> if= ((KeyData->Key.UnicodeChar >=3D L'A') && (KeyData->Key.Un= icodeChar <=3D
> L'Z')) {
> ControlInd= ex =3D KeyData->Key.UnicodeChar - L'A' + 1;
> } else if= ((KeyData->Key.UnicodeChar >=3D L'a') && (KeyData->Key.Un= icodeChar
> <=3D L'z')) {
> ControlInd= ex =3D KeyData->Key.UnicodeChar - L'a' + 1;
> + } else = if ((KeyData->Key.UnicodeChar >=3D L'A' - L'A' + 1) && (KeyDa= ta-
> >Key.UnicodeChar <=3D L'Z' - L'A' + 1)) {
> + ControlIndex =3D KeyData->Key.UnicodeChar;
> + } else if ((KeyData->Key.UnicodeChar >=3D L'a' - L'a' + 1) &= amp;& (KeyData-
> >Key.UnicodeChar <=3D L'z' - L= 'z' + 1)) {
> + ControlIndex =3D KeyData->Key.UnicodeCh= ar;
> }
> }
> if ((SCAN_= CONTROL_Z < ControlIndex)
> diff --git
&g= t; a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c> b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Main= HexEditor.c
> index a00df49d38..394e531c16 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHe= xEditor.c
> +++ b/ShellPkg/Library/UefiShellDebug1Commands= Lib/HexEdit/MainHexEditor.
> +++ c
> @@ -= 137,14 +137,17 @@ HMainCommandDisplayHelp (
> if (KeyData.= Key.UnicodeChar =3D=3D L'W' - L'A' + 1) {
> break;
> }
> - } else if (((KeyData.KeyState.KeyShiftSt= ate & EFI_SHIFT_STATE_VALID) !=3D 0)
> &&
> - ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_P= RESSED |
> EFI_RIGHT_CONTROL_PRESSED)) !=3D 0) &&<= br class=3D"">> - ((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STA= TE_VALID |
> EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_= PRESSED)) =3D=3D 0)) {
> + } else if (((KeyData.KeyState.K= eyShiftState & EFI_SHIFT_STATE_VALID) !=3D 0)
> + &= ;& ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED |> EFI_RIGHT_CONTROL_PRESSED)) !=3D 0)
> + = && ((KeyData.KeyState.KeyShiftState &
> + ~(EF= I_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED |
> + EFI_R= IGHT_CONTROL_PRESSED)) =3D=3D 0)) {
> //
>= ; // For consoles that supports/reports shift state,
> // = make sure that only CONTROL shift key is pressed.
> + // F= or some consoles that report shift state,
> + // CTRL+W is= still translated to L'W' - L'A' + 1.
> //
&= gt; - if ((KeyData.Key.UnicodeChar =3D=3D 'w') || (KeyData.Key.UnicodeChar = =3D=3D 'W'))
> {
> + if ((KeyData.Key.Uni= codeChar =3D=3D 'w') || (KeyData.Key.UnicodeChar =3D=3D 'W')
= > + || (KeyData.Key.UnicodeChar =3D=3D L'w' - L'a' + 1) ||
> + (KeyData.Key.UnicodeChar =3D=3D L'W' - L'A' + 1)) {
&= gt; break;
> }
> }
> --<= br class=3D"">> 2.21.1 (Apple Git-122.3)
>
>
> -=3D-=3D-=3D-=3D-=3D-=3D
> Groups.io Links: You receive all mes= sages sent to this group.
>
> View/Reply = Online (#54122): https://edk2.groups.io/g/devel/messa= ge/54122
> Mute This Topic: https://grou= ps.io/mt/71133729/1768756
> Group Owner: dev= el+owner@edk2.groups.io
> Unsubscribe: ht= tps://edk2.groups.io/g/devel/unsub [zhichao.= gao@intel.com]
> -=3D-=3D-=3D-=3D-=3D-=3D


--Apple-Mail=_FD783D43-18E3-4F71-956E-A0D3B250A842-- -----------------------8af2c860d84f4373c04fdf648f295e5f Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: ProtonMail wsBmBAEBCAAQBQJefdzmCRBPsoxt7Hy0xQAKCRBPsoxt7Hy0xf7sB/wLIV48 WLvtbdjQGc6prlJD1xRjLH9B1iFGxc7RQy3Mm9fGrJNNJgkRnspVMzbDFrMx TjOtkkfXSlS+Mn7qZEdxqCylbZRJ1CO4goMoigimiZNad3S1reiq8Q2uMg0S oNiUmSUKwDX35WGpBlgqER33URE+HWvRO8sPyGptWdUofGp5TaRt+5e0prHL JTbdXkyf419wtXNdXbLgYS6P/7gt1lrGzzw8cwsZa36b4tIs9QFpGp10GPOS 1ENULAXKlzewwBqjYfU9T2uQCS9doJMFniQDJ7vtlp73eRSO545sZmAAp3wF /0se7PHAQoxlZ38ee6hl2LvWOrea1fu9a5YC =PT22 -----END PGP SIGNATURE----- -----------------------8af2c860d84f4373c04fdf648f295e5f--