Revision: 13951
          http://edk2.svn.sourceforge.net/edk2/?rev=13951&view=rev
Author:   vanjeff
Date:     2012-11-17 06:47:17 +0000 (Sat, 17 Nov 2012)
Log Message:
-----------
Sync patches r13942, r13945 and r13946 from main trunk.
Enhance SetupBrowser and CreatePopup to call ReadKeyStroke() before calling 
WaitForEvent(). This can handle the case when the UI is launched in lazy ConIn 
mode.

Revision Links:
--------------
    http://edk2.svn.sourceforge.net/edk2/?rev=13942&view=rev
    http://edk2.svn.sourceforge.net/edk2/?rev=13945&view=rev
    http://edk2.svn.sourceforge.net/edk2/?rev=13946&view=rev

Modified Paths:
--------------
    branches/UDK2010.SR1/IntelFrameworkPkg/Library/FrameworkUefiLib/Console.c
    branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
    branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
    branches/UDK2010.SR1/MdePkg/Library/UefiLib/Console.c

Modified: 
branches/UDK2010.SR1/IntelFrameworkPkg/Library/FrameworkUefiLib/Console.c
===================================================================
--- branches/UDK2010.SR1/IntelFrameworkPkg/Library/FrameworkUefiLib/Console.c   
2012-11-17 06:44:50 UTC (rev 13950)
+++ branches/UDK2010.SR1/IntelFrameworkPkg/Library/FrameworkUefiLib/Console.c   
2012-11-17 06:47:17 UTC (rev 13951)
@@ -1,7 +1,7 @@
 /** @file
   This module provide help function for displaying unicode string.
 
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD 
License         
   which accompanies this distribution.  The full text of the license may be 
found at        
@@ -314,6 +314,7 @@
   ...
   )
 {
+  EFI_STATUS                       Status;
   VA_LIST                          Args;
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *ConOut;
   EFI_SIMPLE_TEXT_OUTPUT_MODE      SavedConsoleMode;
@@ -457,7 +458,19 @@
   // 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);
+    }
   }
 }

Modified: 
branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
===================================================================
--- branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c  
2012-11-17 06:44:50 UTC (rev 13950)
+++ branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c  
2012-11-17 06:47:17 UTC (rev 13951)
@@ -1381,10 +1381,17 @@
 {
   EFI_STATUS  Status;
 
-  do {
-    UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0, 0);
+  while (TRUE) {
     Status = gST->ConIn->ReadKeyStroke (gST->ConIn, Key);
-  } while (EFI_ERROR(Status));
+    if (!EFI_ERROR (Status)) {
+      break;
+    }
 
+    if (Status != EFI_NOT_READY) {
+      continue;
+    }
+
+    UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0, 0);
+  }
   return Status;
 }

Modified: branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
===================================================================
--- branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c    
2012-11-17 06:44:50 UTC (rev 13950)
+++ branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c    
2012-11-17 06:47:17 UTC (rev 13951)
@@ -3088,25 +3088,33 @@
       //
       // Wait for user's selection
       //
-      do {
-        Status = UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0, 
MinRefreshInterval);
-      } while (Status == EFI_TIMEOUT);
+      while (TRUE) {
+        Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
+        if (!EFI_ERROR (Status)) {
+          break;
+        }
 
-      if (Selection->Action == UI_ACTION_REFRESH_FORMSET) {
         //
-        // IFR is updated in Callback of refresh opcode, re-parse it
+        // If we encounter error, continue to read another key in.
         //
-        ControlFlag = CfCheckSelection;
-        Selection->Statement = NULL;
-        break;
+        if (Status != EFI_NOT_READY) {
+          continue;
+        }
+
+        Status = UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0, 
MinRefreshInterval);
+        ASSERT_EFI_ERROR (Status);
+
+        if (Selection->Action == UI_ACTION_REFRESH_FORMSET) {
+          //
+          // IFR is updated in Callback of refresh opcode, re-parse it
+          //
+          ControlFlag = CfCheckSelection;
+          Selection->Statement = NULL;
+          break;
+        }
       }
 
-      Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
-      //
-      // If we encounter error, continue to read another key in.
-      //
-      if (EFI_ERROR (Status)) {
-        ControlFlag = CfReadKey;
+      if (ControlFlag == CfCheckSelection) {
         break;
       }
 

Modified: branches/UDK2010.SR1/MdePkg/Library/UefiLib/Console.c
===================================================================
--- branches/UDK2010.SR1/MdePkg/Library/UefiLib/Console.c       2012-11-17 
06:44:50 UTC (rev 13950)
+++ branches/UDK2010.SR1/MdePkg/Library/UefiLib/Console.c       2012-11-17 
06:47:17 UTC (rev 13951)
@@ -314,6 +314,7 @@
   ...
   )
 {
+  EFI_STATUS                       Status;
   VA_LIST                          Args;
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *ConOut;
   EFI_SIMPLE_TEXT_OUTPUT_MODE      SavedConsoleMode;
@@ -457,7 +458,19 @@
   // 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);
+    }
   }
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to