]> code.delx.au - refind/blobdiff - gptsync/os_efi.c
Work around keyboard input problem in gptsync on some Macs. Minor
[refind] / gptsync / os_efi.c
index 51293d80f00e309a7c0bc8a99623602d5974ea0f..e857f712111a8acde4d34bc4a28e810344afa4db 100644 (file)
@@ -125,15 +125,13 @@ UINTN input_boolean(CHARN *prompt, BOOLEAN *bool_out)
 
     Print(prompt);
 
-    if (ReadAllKeyStrokes()) {  // remove buffered key strokes
-        refit_call1_wrapper(BS->Stall, 500000);      // 0.5 seconds delay
-        ReadAllKeyStrokes();    // empty the buffer again
-    }
-
-    refit_call3_wrapper(BS->WaitForEvent, 1, &ST->ConIn->WaitForKey, &Index);
-    Status = refit_call2_wrapper(ST->ConIn->ReadKeyStroke, ST->ConIn, &Key);
-    if (EFI_ERROR(Status))
-        return 1;
+    ReadAllKeyStrokes(); // Remove buffered key strokes
+    do {
+        refit_call3_wrapper(BS->WaitForEvent, 1, &ST->ConIn->WaitForKey, &Index);
+        Status = refit_call2_wrapper(ST->ConIn->ReadKeyStroke, ST->ConIn, &Key);
+        if (EFI_ERROR(Status) && Status != EFI_NOT_READY)
+            return 1;
+    } while (Status == EFI_NOT_READY);
 
     if (Key.UnicodeChar == 'y' || Key.UnicodeChar == 'Y') {
         Print(L"Yes\n");