mirror of
https://github.com/Metabolix/HackBGRT.git
synced 2026-09-26 14:01:19 -07:00
Implement WaitKey without gnu-efi
This commit is contained in:
+13
-1
@@ -162,7 +162,19 @@ void RandomSeedAuto(void) {
|
|||||||
EFI_STATUS WaitKey(UINT64 timeout_ms) {
|
EFI_STATUS WaitKey(UINT64 timeout_ms) {
|
||||||
ST->ConIn->Reset(ST->ConIn, FALSE);
|
ST->ConIn->Reset(ST->ConIn, FALSE);
|
||||||
const int ms_to_100ns = 10000;
|
const int ms_to_100ns = 10000;
|
||||||
return WaitForSingleEvent(ST->ConIn->WaitForKey, timeout_ms * ms_to_100ns);
|
|
||||||
|
EFI_EVENT events[2] = {ST->ConIn->WaitForKey};
|
||||||
|
EFI_STATUS status = BS->CreateEvent(EVT_TIMER, 0, NULL, NULL, &events[1]);
|
||||||
|
if (!EFI_ERROR(status)) {
|
||||||
|
BS->SetTimer(events[1], TimerRelative, timeout_ms * ms_to_100ns);
|
||||||
|
UINTN index;
|
||||||
|
status = BS->WaitForEvent(2, events, &index);
|
||||||
|
BS->CloseEvent(events[1]);
|
||||||
|
if (!EFI_ERROR(status) && index == 1) {
|
||||||
|
status = EFI_TIMEOUT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_INPUT_KEY ReadKey(UINT64 timeout_ms) {
|
EFI_INPUT_KEY ReadKey(UINT64 timeout_ms) {
|
||||||
|
|||||||
Reference in New Issue
Block a user