]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Enhance CreatePopup to call ReadKeyStroke() before calling WaitForEvent(). This can...
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 15 Nov 2012 06:31:25 +0000 (06:31 +0000)
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 15 Nov 2012 06:31:25 +0000 (06:31 +0000)
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

MdePkg/Library/UefiLib/Console.c

index 41a9f3db97ee7eea6b4e8b6d4bee879a58499961..dd4d5c544bf85aa83189d0d43c3b4b5d8c1f20d9 100644 (file)
@@ -406,6 +406,7 @@ CreatePopUp (
   ...\r
   )\r
 {\r
+  EFI_STATUS                       Status;\r
   VA_LIST                          Args;\r
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *ConOut;\r
   EFI_SIMPLE_TEXT_OUTPUT_MODE      SavedConsoleMode;\r
@@ -554,7 +555,19 @@ CreatePopUp (
   // Wait for a keystroke\r
   //\r
   if (Key != NULL) {\r
-    gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);\r
-    gST->ConIn->ReadKeyStroke (gST->ConIn, Key);\r
+    while (TRUE) {\r
+      Status = gST->ConIn->ReadKeyStroke (gST->ConIn, Key);\r
+      if (!EFI_ERROR (Status)) {\r
+        break;\r
+      }\r
+\r
+      //\r
+      // If we encounter error, continue to read another key in.\r
+      //\r
+      if (Status != EFI_NOT_READY) {\r
+        continue;\r
+      }\r
+      gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);\r
+    }\r
   }\r
 }\r