]> 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:43 +0000 (06:31 +0000)
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 15 Nov 2012 06:31:43 +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@13946 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkPkg/Library/FrameworkUefiLib/Console.c

index a8ecc27e64d97731703fe2ba7407d1a3dd409ce0..244e532f577e129be60b882828ef3d10efa7a1cb 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This module provide help function for displaying unicode string.\r
 \r
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials                          \r
   are licensed and made available under the terms and conditions of the BSD License         \r
   which accompanies this distribution.  The full text of the license may be found at        \r
@@ -314,6 +314,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
@@ -457,7 +458,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