diff options
author | Matt Fleming <matt.fleming@intel.com> | 2012-11-15 10:18:49 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2012-11-15 10:18:49 +0000 |
commit | bd7ce1bbf3393be32ee63a5139fffd1aae11c7fd (patch) | |
tree | ac54b1e05902c3bdbe3368d8bb9e937bf1853def | |
parent | 023cbfcba3a526e5d906616f373e278821e45b1e (diff) | |
download | syslinux-bd7ce1bbf3393be32ee63a5139fffd1aae11c7fd.tar.gz syslinux-bd7ce1bbf3393be32ee63a5139fffd1aae11c7fd.tar.xz syslinux-bd7ce1bbf3393be32ee63a5139fffd1aae11c7fd.zip |
efi: Consume unprocessed user input before loading ldlinux.c32
Consume and discard any pending user input that is received before we
load ldlinux.c32 and present the user with a "boot:" prompt.
This bug was discovered after commit 7cb503fd746b ("ldlinux: get_key()
requires raw access to user input") because user input was previously
handled with __stdcon_read() which would discard any incoming newline
characters. It turns out that if syslinux.efi is invoked from the EFI
shell the shell doesn't process the last newline character generated
when the user hits the return key and __raw_read() was returning this
as valid input.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r-- | efi/main.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -1109,6 +1109,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *table) const struct fs_ops *ops[] = { &vfat_fs_ops, NULL }; unsigned long len = (unsigned long)__bss_end - (unsigned long)__bss_start; static struct disk_private priv; + SIMPLE_INPUT_INTERFACE *in; + EFI_INPUT_KEY key; EFI_EVENT timer_ev; memset(__bss_start, 0, len); @@ -1150,6 +1152,16 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *table) fs_init(ops, &priv); + /* + * There may be pending user input that wasn't processed by + * whatever application invoked us. Consume and discard that + * data now. + */ + in = ST->ConIn; + do { + status = uefi_call_wrapper(in->ReadKeyStroke, 2, in, &key); + } while (status != EFI_NOT_READY); + load_env32(); /* load_env32() failed.. cancel timer and bailout */ |