Set EFI ReadKey timeout to 15 seconds

This commit is contained in:
Lauri Kenttä
2023-09-02 23:31:02 +03:00
parent e44ce9f5ee
commit ad0b71c49b
3 changed files with 19 additions and 14 deletions

View File

@@ -68,14 +68,15 @@ void RandomSeedAuto(void) {
RandomSeed(a, b), Random(), Random();
}
void WaitKey(void) {
EFI_STATUS WaitKey(UINT64 timeout_ms) {
ST->ConIn->Reset(ST->ConIn, FALSE);
WaitForSingleEvent(ST->ConIn->WaitForKey, 0);
const int ms_to_100ns = 10000;
return WaitForSingleEvent(ST->ConIn->WaitForKey, timeout_ms * ms_to_100ns);
}
EFI_INPUT_KEY ReadKey(void) {
WaitKey();
EFI_INPUT_KEY ReadKey(UINT64 timeout_ms) {
EFI_INPUT_KEY key = {0};
WaitKey(timeout_ms);
ST->ConIn->ReadKeyStroke(ST->ConIn, &key);
return key;
}