From f7f280c9e01977824a109d5a7dd8951ea5c29448 Mon Sep 17 00:00:00 2001 From: Matt H Date: Sat, 9 May 2015 18:04:30 -0400 Subject: [PATCH] Added keyboard error scancode checking --- src/efi/console.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/efi/console.c b/src/efi/console.c index 6206c80..340aa28 100644 --- a/src/efi/console.c +++ b/src/efi/console.c @@ -84,7 +84,7 @@ EFI_STATUS console_key_read(UINT64 *key, BOOLEAN wait) { static BOOLEAN checked; UINTN index; EFI_INPUT_KEY k; - EFI_STATUS err; + EFI_STATUS err, fb_err; if (!checked) { err = LibLocateProtocol(&EfiSimpleTextInputExProtocolGuid, (VOID **)&TextInputEx); @@ -132,8 +132,12 @@ EFI_STATUS console_key_read(UINT64 *key, BOOLEAN wait) { * This is also called in case ReadKeyStrokeEx did not return a key, because * some broken firmwares offer SimpleTextInputExProtocol, but never acually * handle any key. */ - err = uefi_call_wrapper(ST->ConIn->ReadKeyStroke, 2, ST->ConIn, &k); - if (EFI_ERROR(err)) + fb_err = uefi_call_wrapper(ST->ConIn->ReadKeyStroke, 2, ST->ConIn, &k); + if (EFI_ERROR(fb_err)) + return fb_err; + + /* check for keyboard error scancode and return original error if so */ + if (k.ScanCode == 0 | k.ScanCode == 0xff) return err; *key = KEYPRESS(0, k.ScanCode, k.UnicodeChar); -- 2.3.7