summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2012-11-15 06:31:25 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2012-11-15 06:31:25 +0000
commitf04544be831bc925c1d5dceddd7809bcc298c4d7 (patch)
tree9927f752b3585c2fedb1fa04f67b984d3cdce86e
parent22921b02abdf31eafdd823d1233fb6fc6f3b03cc (diff)
downloadedk2-platforms-f04544be831bc925c1d5dceddd7809bcc298c4d7.tar.xz
Enhance CreatePopup to call ReadKeyStroke() before calling WaitForEvent(). This can handle the case when in lazy ConIn mode.
Signed-off-by: Ruiyu Ni<ruiyu.ni@intel.com> Reviewed-by: Eric Dong<eric.dong@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13945 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdePkg/Library/UefiLib/Console.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/MdePkg/Library/UefiLib/Console.c b/MdePkg/Library/UefiLib/Console.c
index 41a9f3db97..dd4d5c544b 100644
--- a/MdePkg/Library/UefiLib/Console.c
+++ b/MdePkg/Library/UefiLib/Console.c
@@ -406,6 +406,7 @@ CreatePopUp (
...
)
{
+ EFI_STATUS Status;
VA_LIST Args;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
EFI_SIMPLE_TEXT_OUTPUT_MODE SavedConsoleMode;
@@ -554,7 +555,19 @@ CreatePopUp (
// Wait for a keystroke
//
if (Key != NULL) {
- gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
- gST->ConIn->ReadKeyStroke (gST->ConIn, Key);
+ while (TRUE) {
+ Status = gST->ConIn->ReadKeyStroke (gST->ConIn, Key);
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+
+ //
+ // If we encounter error, continue to read another key in.
+ //
+ if (Status != EFI_NOT_READY) {
+ continue;
+ }
+ gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
+ }
}
}