MdeModulePkg/BdsDxe: drain setup request input

Hotkey notifications leave a copy queued for ReadKeyStroke(). Drain it
before OS-requested setup so Enter cannot immediately select Continue.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
This commit is contained in:
Sean Rhodes 2026-07-28 17:53:07 +01:00
parent 5e27206f82
commit 82c9a82d8f

View file

@ -276,6 +276,27 @@ BdsWaitForSingleEvent (
return Status; return Status;
} }
/**
Drain queued console input.
**/
STATIC
VOID
BdsDrainConsoleInput (
VOID
)
{
EFI_INPUT_KEY Key;
EFI_STATUS Status;
while (gST->ConIn != NULL) {
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
if (EFI_ERROR (Status)) {
break;
}
}
}
/** /**
The function waits for the boot manager timeout expires or hotkey is pressed. The function waits for the boot manager timeout expires or hotkey is pressed.
@ -1010,6 +1031,12 @@ BdsEntry (
BdsDxeOnConnectConInCallBack (NULL, NULL); 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. // Directly enter the setup page.
// //