Enhance SetupBrowser to call ReadKeyStroke() before calling WaitForEvent(). This can handle the case when the UI is launched in lazy ConIn mode.

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
This commit is contained in:
niruiyu 2012-11-14 06:30:39 +00:00
parent 467cacbf77
commit 9cdadb7c94
2 changed files with 32 additions and 17 deletions

View File

@ -1384,10 +1384,17 @@ WaitForKeyStroke (
{ {
EFI_STATUS Status; EFI_STATUS Status;
do { while (TRUE) {
UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0, 0);
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, Key); 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; return Status;
} }

View File

@ -3110,25 +3110,33 @@ UiDisplayMenu (
// //
// Wait for user's selection // Wait for user's selection
// //
do { while (TRUE) {
Status = UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0, MinRefreshInterval); Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
} while (Status == EFI_TIMEOUT); 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; if (Status != EFI_NOT_READY) {
Selection->Statement = NULL; continue;
break; }
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 (ControlFlag == CfCheckSelection) {
//
// If we encounter error, continue to read another key in.
//
if (EFI_ERROR (Status)) {
ControlFlag = CfReadKey;
break; break;
} }