Reviewed-by: Qiu Shumin <[email protected]>

From: Pedroa [mailto:[email protected]]
Sent: Monday, May 16, 2016 9:18 PM
To: edk2-devel-01
Cc: Qiu, Shumin; Carsey, Jaben
Subject: Re: [edk2][PATCH] ShellPkg if user press "shift" key under shell 
command line that have incorrect behavior

if 'ReadKeyStroke' function return EFI_NOT_READY then skip it, but if the 
return value is EFI_DEVICE_ERROR ,empty the currentString buffer.


Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Pedroa Liu <[email protected]<mailto:[email protected]>>
---
 ShellPkg/Application/Shell/FileHandleWrappers.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.c
b/ShellPkg/Application/Shell/FileHandleWrappers.c
index 0e5efe3..f64915d 100644
--- a/ShellPkg/Application/Shell/FileHandleWrappers.c
+++ b/ShellPkg/Application/Shell/FileHandleWrappers.c
@@ -422,6 +422,12 @@ FileInterfaceStdInRead(
     gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
     Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
     if (EFI_ERROR (Status)) {
+
+      if (Status == EFI_NOT_READY)
+        continue;
+
+      ZeroMem (CurrentString, MaxStr * sizeof(CHAR16));
+      StringLen = 0;
        break;
     }

--
2.1.4

On 2016年05月15日 15:42, Pedroa wrote:
> when the user press "shift" key , the shell core read the data from
> STDIN and thought that a bad value so it resume then reset the
> position of the cursor and keep waiting for user input.
>
> if use "ReadKeyStroke" function to read STDIN when it read a "shift"
> key ,it would return a value "EFI_NOT_READY". so we can skip it or use
> "ReadKeyStrokeEx"  to replace it.
>
> diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.c
> b/ShellPkg/Application/Shell/FileHandleWrappers.c
> index 0e5efe3..dcc2225 100644
> --- a/ShellPkg/Application/Shell/FileHandleWrappers.c
> +++ b/ShellPkg/Application/Shell/FileHandleWrappers.c
> @@ -421,7 +421,7 @@ FileInterfaceStdInRead(
>      //
>      gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
>      Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
> -    if (EFI_ERROR (Status)) {
> +    if (EFI_ERROR (Status) && Status != EFI_NOT_READY) {
>        break;
>      }
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to