This commit is contained in:
Sean Rhodes 2026-08-26 18:13:54 -07:00 committed by GitHub
commit affc726a7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -277,28 +277,21 @@ BdsWaitForSingleEvent (
}
/**
The function reads user inputs.
Drain queued console input.
**/
STATIC
VOID
BdsReadKeys (
BdsDrainConsoleInput (
VOID
)
{
EFI_STATUS Status;
EFI_INPUT_KEY Key;
if (PcdGetBool (PcdConInConnectOnDemand)) {
return;
}
EFI_STATUS Status;
while (gST->ConIn != NULL) {
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
if (EFI_ERROR (Status)) {
//
// No more keys.
//
break;
}
}
@ -326,9 +319,6 @@ BdsWait (
DEBUG ((DEBUG_INFO, "[Bds]BdsWait(%d)..Zzzz...\n", (UINTN)TimeoutRemain));
PlatformBootManagerWaitCallback (TimeoutRemain);
BdsReadKeys (); // BUGBUG: Only reading can signal HotkeyTriggered
// Can be removed after all keyboard drivers invoke callback in timer callback.
if (HotkeyTriggered != NULL) {
Status = BdsWaitForSingleEvent (HotkeyTriggered, EFI_TIMER_PERIOD_SECONDS (1));
if (!EFI_ERROR (Status)) {
@ -1041,6 +1031,12 @@ BdsEntry (
BdsDxeOnConnectConInCallBack (NULL, NULL);
}
//
// A hotkey notification can leave the same key queued for ReadKeyStroke().
// Consume it before Enter can immediately select Continue in Front Page.
//
BdsDrainConsoleInput ();
//
// Directly enter the setup page.
//
@ -1063,11 +1059,6 @@ BdsEntry (
PERF_INMODULE_BEGIN ("BdsWait");
BdsWait (HotkeyTriggered);
PERF_INMODULE_END ("BdsWait");
//
// BdsReadKeys() can be removed after all keyboard drivers invoke callback in timer callback.
//
BdsReadKeys ();
EfiBootManagerHotkeyBoot ();
if (BootNext != NULL) {