From nobody Sun May 5 07:24:12 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 152092686550384.15319235221637; Tue, 13 Mar 2018 00:41:05 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6E33A22631478; Tue, 13 Mar 2018 00:34:42 -0700 (PDT) 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 57096224488A1 for ; Tue, 13 Mar 2018 00:34:41 -0700 (PDT) Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2018 00:41:02 -0700 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.4]) by fmsmga007.fm.intel.com with ESMTP; 13 Mar 2018 00:41:01 -0700 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.47,464,1515484800"; d="scan'208";a="23828716" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Tue, 13 Mar 2018 15:40:59 +0800 Message-Id: <20180313074059.98580-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.16.1.windows.1 In-Reply-To: References: Subject: [edk2] [PATCH] ShellPkg/[hex]edit: Fix mouse freeze issue 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" In edit or hexedit, the mouse cursor doesn't move when moving the mouse. The root cause is 5563281fa2b31093a1cbd415553b9264c5136e89 * ShellPkg/[hex]edit: use SimpleTextInEx to read console wrongly uses WaitForEvent() to listen keyboard input. It blocks the code execution when there is no keyboard input. While the same function also polls the mouse move status, the mouse movement cannot be reflected to the screen when there is no keyboard input. The patch fixes the issue by use CheckEvent() instead of WaitForEvent(). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Jaben Carsey Reviewed-by: Jaben Carsey --- .../UefiShellDebug1CommandsLib/Edit/MainTextEditor.c | 16 +++++++++---= ---- .../UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c | 16 +++++++++---= ---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEdito= r.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c index 6832441e81..98e1331ac4 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c @@ -1840,7 +1840,6 @@ MainEditorKeyInput ( EFI_KEY_DATA KeyData; EFI_STATUS Status; EFI_SIMPLE_POINTER_STATE MouseState; - UINTN EventIndex; BOOLEAN NoShiftState; =20 do { @@ -1876,8 +1875,11 @@ MainEditorKeyInput ( } } =20 - Status =3D gBS->WaitForEvent (1, &MainEditor.TextInputEx->WaitForKeyEx= , &EventIndex); - if (!EFI_ERROR (Status) && EventIndex =3D=3D 0) { + // + // CheckEvent() returns Success when non-partial key is pressed. + // + Status =3D gBS->CheckEvent (MainEditor.TextInputEx->WaitForKeyEx); + if (!EFI_ERROR (Status)) { Status =3D MainEditor.TextInputEx->ReadKeyStrokeEx (MainEditor.TextI= nputEx, &KeyData); if (!EFI_ERROR (Status)) { // @@ -1917,11 +1919,11 @@ MainEditorKeyInput ( } =20 } - // - // after handling, refresh editor - // - MainEditorRefresh (); } + // + // after handling, refresh editor + // + MainEditorRefresh (); =20 } while (Status !=3D EFI_OUT_OF_RESOURCES && !EditorExit); =20 diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEdi= tor.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c index a2e52ea39c..1a89d3d72a 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c @@ -2108,7 +2108,6 @@ HMainEditorKeyInput ( EFI_KEY_DATA KeyData; EFI_STATUS Status; EFI_SIMPLE_POINTER_STATE MouseState; - UINTN EventIndex; BOOLEAN NoShiftState; BOOLEAN LengthChange; UINTN Size; @@ -2268,8 +2267,11 @@ HMainEditorKeyInput ( } } =20 - Status =3D gBS->WaitForEvent (1, &HMainEditor.TextInputEx->WaitForKeyE= x, &EventIndex); - if (!EFI_ERROR (Status) && EventIndex =3D=3D 0) { + // + // CheckEvent() returns Success when non-partial key is pressed. + // + Status =3D gBS->CheckEvent (HMainEditor.TextInputEx->WaitForKeyEx); + if (!EFI_ERROR (Status)) { Status =3D HMainEditor.TextInputEx->ReadKeyStrokeEx (HMainEditor.Tex= tInputEx, &KeyData); if (!EFI_ERROR (Status)) { // @@ -2351,11 +2353,11 @@ HMainEditorKeyInput ( } } } - // - // after handling, refresh editor - // - HMainEditorRefresh (); } + // + // after handling, refresh editor + // + HMainEditorRefresh (); =20 } while (Status !=3D EFI_OUT_OF_RESOURCES && !HEditorExit); =20 --=20 2.16.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel