Laszlo,

I refine the code in ShowProgress(). when TimeoutDefault is zero, BDS also read 
key. I have verified it works. Please check this new code.

Thanks,
Eric
-----Original Message-----
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Thursday, October 23, 2014 7:34 PM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] [PATCH v2 2/9] IntelFrameworkModulePkg: BdsDxe: poll keyboard 
at front page with zero timeout

When PlatformBdsEnterFrontPage() is called with a zero TimeoutDefault value, 
PlatformBdsEnterFrontPage() --> ShowProgress() returns EFI_TIMEOUT immediately, 
without looking at the keyboard at all.

This is slightly incorrect, because a keypress might already be pending at that 
time. Change ShowProgress() such that it polls the keyboard once even if 
TimeoutDefault equals zero, using a 100 nanosecond event timeout.

(The UEFI specification explicitly allows a zero TriggerTime argument in
gBS->SetTimer() -- meaning "next timer tick" for TimerRelative --, but
passing zero to gBS->SetTimer() would require a reorganization of the
WaitForSingleEvent() utility function. So let's just use a 100ns timeout
here: it is indistinguishable from "next timer tick" for the purposes of 
polling the keyboard for an already pending keypress.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---

Notes:
    v2:
    - new in v2

 IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c 
b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
index 219f691..c093416 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
@@ -931,7 +931,15 @@ ShowProgress (
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
 
   if (TimeoutDefault == 0) {
-    return EFI_TIMEOUT;
+    //
+    // this amounts to a poll -- 1 * 100ns timeout
+    //
+    Status = WaitForSingleEvent (gST->ConIn->WaitForKey, 1);
+
+    if (Status == EFI_TIMEOUT) {
+      return EFI_TIMEOUT;
+    }
+    return HandleKeyPress ();
   }
 
   DEBUG ((EFI_D_INFO, "\n\nStart showing progress bar... Press any key to stop 
it! ...Zzz....\n"));
--
1.8.3.1



------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Attachment: FrontPage.c.patch
Description: FrontPage.c.patch

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to