mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
OcMiscLib/DebugHelp: Manually poll event instead of waiting (EFI_UNSUPPORTED on Insyde)
This commit is contained in:
parent
e4ccb06cb6
commit
6c8ea98d03
@ -71,9 +71,7 @@ WaitForKeyIndex (
|
||||
EFI_STATUS Status;
|
||||
EFI_INPUT_KEY Key;
|
||||
INTN Index;
|
||||
UINTN EventIndex;
|
||||
EFI_EVENT TimerEvent;
|
||||
EFI_EVENT WaitList[2];
|
||||
|
||||
//
|
||||
// Skip previously pressed characters.
|
||||
@ -100,27 +98,36 @@ WaitForKeyIndex (
|
||||
//
|
||||
// Wait for the keystroke event or the timer
|
||||
//
|
||||
WaitList[0] = gST->ConIn->WaitForKey;
|
||||
WaitList[1] = TimerEvent;
|
||||
Status = gBS->WaitForEvent (TimerEvent != NULL ? 2 : 1, WaitList, &EventIndex);
|
||||
if (TimerEvent != NULL) {
|
||||
do {
|
||||
//
|
||||
// Read our key otherwise.
|
||||
//
|
||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
Status = gBS->CheckEvent (TimerEvent);
|
||||
//
|
||||
// Check for the timer expiration
|
||||
//
|
||||
if (!EFI_ERROR (Status)) {
|
||||
gBS->CloseEvent (TimerEvent);
|
||||
return OC_INPUT_TIMEOUT;
|
||||
}
|
||||
} while (Status == EFI_NOT_READY);
|
||||
|
||||
gBS->CloseEvent (TimerEvent);
|
||||
} else {
|
||||
//
|
||||
// Read our key otherwise.
|
||||
//
|
||||
do {
|
||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
} while (EFI_ERROR (Status));
|
||||
}
|
||||
|
||||
//
|
||||
// Check for the timer expiration
|
||||
//
|
||||
if (!EFI_ERROR (Status) && EventIndex == 1) {
|
||||
return OC_INPUT_TIMEOUT;
|
||||
}
|
||||
|
||||
//
|
||||
// Read our key otherwise.
|
||||
//
|
||||
do {
|
||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
} while (EFI_ERROR (Status));
|
||||
|
||||
if (Key.ScanCode == SCAN_ESC || Key.UnicodeChar == '0') {
|
||||
return OC_INPUT_ABORTED;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user