From nobody Sun May 5 10:23:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1518515085590135.84952443383975; Tue, 13 Feb 2018 01:44:45 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4061021CF1D09; Tue, 13 Feb 2018 01:38:52 -0800 (PST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 66AE521CF1CF7 for ; Tue, 13 Feb 2018 01:38:50 -0800 (PST) Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2018 01:44:40 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.19]) by orsmga008.jf.intel.com with ESMTP; 13 Feb 2018 01:44:39 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,507,1511856000"; d="scan'208";a="17731985" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Tue, 13 Feb 2018 17:44:38 +0800 Message-Id: <20180213094438.119760-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.16.1.windows.1 Subject: [edk2] [PATCH] ShellPkg/[hex]edit: Fix CTRL+ doesn't work from hyper terminal X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jaben Carsey MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" After commit 20ddbc133f679b7895dfdaf2fd58ec4c8183a1d8 * MdeModulePkg/ConSplitter: ReadKeyStrokeEx always return key state When one physical console supports to report the shift key state, the key data returned from ConSplitter driver at least carries the shift key valid bit. The patch fixes the edit/hexedit to accept Unicode (1) when the no shift key is pressed or reported. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Jaben Carsey Reviewed-by: Jaben Carsey --- .../Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c | 10 ++++++= ---- ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c | 10 ++++++= ---- .../Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c | 10 ++++++= ---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEdito= r.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c index 4eb998bf5f..6832441e81 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c @@ -1387,18 +1387,20 @@ MainCommandDisplayHelp ( continue; } =20 - if ((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) =3D=3D 0)= { + 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 shift state reporting, + // For consoles that don't support/report shift state, // CTRL+W is translated to L'W' - L'A' + 1. // if (KeyData.Key.UnicodeChar =3D=3D L'W' - L'A' + 1) { break; } - } else if (((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSE= D | EFI_RIGHT_CONTROL_PRESSED)) !=3D 0) && + } else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != =3D 0) && + ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSE= D | 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 shift state reporting, + // For consoles that supports/reports shift state, // make sure that only CONTROL shift key is pressed. // if ((KeyData.Key.UnicodeChar =3D=3D 'w') || (KeyData.Key.UnicodeChar= =3D=3D 'W')) { diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c b/Sh= ellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c index b86594bb28..58e90ac5b2 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c @@ -183,16 +183,18 @@ MenuBarDispatchControlHotKey ( // ControlIndex =3D MAX_UINT16; =20 - if ((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) =3D=3D 0) { + if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) =3D=3D 0)= || + (KeyData->KeyState.KeyShiftState =3D=3D EFI_SHIFT_STATE_VALID)) { // - // For those console devices that cannot report the CONTROL state, + // For consoles that don't support/report shift state, // Ctrl+A is translated to 1 (UnicodeChar). // ControlIndex =3D KeyData->Key.UnicodeChar; - } else if (((KeyData->KeyState.KeyShiftState & (EFI_RIGHT_CONTROL_PRESSE= D | EFI_LEFT_CONTROL_PRESSED)) !=3D 0) && + } else if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != =3D 0) && + ((KeyData->KeyState.KeyShiftState & (EFI_RIGHT_CONTROL_PRESSE= D | EFI_LEFT_CONTROL_PRESSED)) !=3D 0) && ((KeyData->KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID |= EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) =3D=3D 0)) { // - // For those console devices that can report the CONTROL state, + // For consoles that supports/reports shift state, // make sure only CONTROL is pressed. // if ((KeyData->Key.UnicodeChar >=3D L'A') && (KeyData->Key.UnicodeChar = <=3D L'Z')) { diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEdi= tor.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c index 2b096d7168..a2e52ea39c 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c @@ -134,18 +134,20 @@ HMainCommandDisplayHelp ( continue; } =20 - if ((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) =3D=3D 0)= { + 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 shift state reporting, + // For consoles that don't support/report shift state, // CTRL+W is translated to L'W' - L'A' + 1. // if (KeyData.Key.UnicodeChar =3D=3D L'W' - L'A' + 1) { break; } - } else if (((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSE= D | EFI_RIGHT_CONTROL_PRESSED)) !=3D 0) && + } else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != =3D 0) && + ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSE= D | 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 shift state reporting, + // For consoles that supports/reports shift state, // make sure that only CONTROL shift key is pressed. // if ((KeyData.Key.UnicodeChar =3D=3D 'w') || (KeyData.Key.UnicodeChar= =3D=3D 'W')) { --=20 2.16.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel