]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Enhance SetupBrowser to call ReadKeyStroke() before calling WaitForEvent(). This...
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 14 Nov 2012 06:30:39 +0000 (06:30 +0000)
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 14 Nov 2012 06:30:39 +0000 (06:30 +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@13942 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
MdeModulePkg/Universal/SetupBrowserDxe/Ui.c

index 720efb9a04331f927d9785792570dff0dd9a841e..ae783b4ae336a3ba45e7a366f6128c11f64f6051 100644 (file)
@@ -1384,10 +1384,17 @@ WaitForKeyStroke (
 {\r
   EFI_STATUS  Status;\r
 \r
-  do {\r
-    UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0, 0);\r
+  while (TRUE) {\r
     Status = gST->ConIn->ReadKeyStroke (gST->ConIn, Key);\r
-  } while (EFI_ERROR(Status));\r
+    if (!EFI_ERROR (Status)) {\r
+      break;\r
+    }\r
 \r
+    if (Status != EFI_NOT_READY) {\r
+      continue;\r
+    }\r
+\r
+    UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0, 0);\r
+  }\r
   return Status;\r
 }\r
index d0d45277a19cd5fb37d5459d33aa4e3becfdcd12..b011ad39ecbe5cd8b4e36b47022b5883da364a88 100644 (file)
@@ -3110,25 +3110,33 @@ UiDisplayMenu (
       //\r
       // Wait for user's selection\r
       //\r
-      do {\r
-        Status = UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0, MinRefreshInterval);\r
-      } while (Status == EFI_TIMEOUT);\r
+      while (TRUE) {\r
+        Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
+        if (!EFI_ERROR (Status)) {\r
+          break;\r
+        }\r
 \r
-      if (Selection->Action == UI_ACTION_REFRESH_FORMSET) {\r
         //\r
-        // IFR is updated in Callback of refresh opcode, re-parse it\r
+        // If we encounter error, continue to read another key in.\r
         //\r
-        ControlFlag = CfCheckSelection;\r
-        Selection->Statement = NULL;\r
-        break;\r
+        if (Status != EFI_NOT_READY) {\r
+          continue;\r
+        }\r
+\r
+        Status = UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0, MinRefreshInterval);\r
+        ASSERT_EFI_ERROR (Status);\r
+\r
+        if (Selection->Action == UI_ACTION_REFRESH_FORMSET) {\r
+          //\r
+          // IFR is updated in Callback of refresh opcode, re-parse it\r
+          //\r
+          ControlFlag = CfCheckSelection;\r
+          Selection->Statement = NULL;\r
+          break;\r
+        }\r
       }\r
 \r
-      Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
-      //\r
-      // If we encounter error, continue to read another key in.\r
-      //\r
-      if (EFI_ERROR (Status)) {\r
-        ControlFlag = CfReadKey;\r
+      if (ControlFlag == CfCheckSelection) {\r
         break;\r
       }\r
 \r