]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-boot: Add a 0.1 second delay before key-probing for showing menu
authorLeonid Bloch <lbloch@janustech.com>
Sun, 1 Dec 2019 23:05:02 +0000 (01:05 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 4 Dec 2019 09:52:28 +0000 (10:52 +0100)
If there is no boot menu timeout, pressing a key during boot should get
the boot menu displayed. However, on some systems the keyboard is not
initialized right away, which causes the menu to be inaccessible if no
timeout is specified.

To resolve this, if the error is "not ready" after the initial attempt of
detection, wait for 0.1 second and retry. This solves the problem
described above on all the tested systems.

The reason for just a single retry, and not retrying while "not ready",
is that some firmwares continue to return the "not ready" error on
every probe attempt if no key is pressed.

Signed-off-by: Leonid Bloch <lb.workbox@gmail.com>
src/boot/efi/boot.c

index 849c3c63b6a984a951a6ef684e5c0029b8257924..20ded3a63025ea1721c442a9a0e3f334fe6c4f1a 100644 (file)
@@ -2453,6 +2453,12 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
                 UINT64 key;
 
                 err = console_key_read(&key, FALSE);
+
+                if (err == EFI_NOT_READY) {
+                        uefi_call_wrapper(BS->Stall, 1, 100 * 1000);
+                        err = console_key_read(&key, FALSE);
+                }
+
                 if (!EFI_ERROR(err)) {
                         INT16 idx;