]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiLib/Console.c
Enhance CreatePopup to call ReadKeyStroke() before calling WaitForEvent(). This can...
[mirror_edk2.git] / 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