From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 60F1F22487289 for ; Tue, 13 Mar 2018 07:46:27 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2018 07:52:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,465,1515484800"; d="scan'208";a="34626027" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga003.jf.intel.com with ESMTP; 13 Mar 2018 07:52:48 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 13 Mar 2018 07:52:48 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.34]) by FMSMSX151.amr.corp.intel.com ([169.254.7.150]) with mapi id 14.03.0319.002; Tue, 13 Mar 2018 07:52:48 -0700 From: "Carsey, Jaben" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] ShellPkg/[hex]edit: Fix mouse freeze issue Thread-Index: AQHTup6vr1BaecOCoUGxvAijfjrdw6POQJ8A Date: Tue, 13 Mar 2018 14:52:47 +0000 Message-ID: References: <20180313074059.98580-1-ruiyu.ni@intel.com> In-Reply-To: <20180313074059.98580-1-ruiyu.ni@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjRjNWYxZWMtMTAxNS00ZjUwLWE3NmItZjUxNjNiYTAxMTE4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImR0cnM5YzVDQjJ4SmQwZE5hNEVCemRFRUN3TVpoTVR4UkRmUk1kdzJWejg9In0= x-ctpclassification: CTP_NT x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Tue, 13 Mar 2018 14:46:27 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Ruiyu Ni > Sent: Tuesday, March 13, 2018 12:41 AM > To: edk2-devel@lists.01.org > Cc: Carsey, Jaben > Subject: [edk2] [PATCH] ShellPkg/[hex]edit: Fix mouse freeze issue > Importance: High >=20 > 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. >=20 > The patch fixes the issue by use CheckEvent() instead of > WaitForEvent(). >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ruiyu Ni > Cc: Jaben Carsey > --- > .../UefiShellDebug1CommandsLib/Edit/MainTextEditor.c | 16 +++++++++- > ------ > .../UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c | 16 > +++++++++------- > 2 files changed, 18 insertions(+), 14 deletions(-) >=20 > diff --git > a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.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->WaitForKey= Ex, > &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.TextInputEx, &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/MainHexEditor.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- > >WaitForKeyEx, &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.TextInputEx, &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 > -- > 2.16.1.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel