diff options
author | Jan Janssen <medhefgo@web.de> | 2022-08-24 11:01:02 +0200 |
---|---|---|
committer | Jan Janssen <medhefgo@web.de> | 2022-09-07 12:55:55 +0200 |
commit | d17d0e67707c8630750eca07f175911543fabffb (patch) | |
tree | ef0ae51733f337f98f0a04da6875b71b5142b014 | |
parent | boot: Refuse GPT with invalid entry size (diff) | |
download | systemd-d17d0e67707c8630750eca07f175911543fabffb.tar.xz systemd-d17d0e67707c8630750eca07f175911543fabffb.zip |
boot: Correctly handle shift keys
-rw-r--r-- | src/boot/efi/console.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/boot/efi/console.c b/src/boot/efi/console.c index f61199ccfd..14c0008afb 100644 --- a/src/boot/efi/console.c +++ b/src/boot/efi/console.c @@ -132,14 +132,19 @@ EFI_STATUS console_key_read(uint64_t *key, uint64_t timeout_usec) { if (FLAGS_SET(keydata.KeyState.KeyShiftState, EFI_SHIFT_STATE_VALID)) { /* Do not distinguish between left and right keys (set both flags). */ - if (keydata.KeyState.KeyShiftState & EFI_SHIFT_PRESSED) - shift |= EFI_SHIFT_PRESSED; if (keydata.KeyState.KeyShiftState & EFI_CONTROL_PRESSED) shift |= EFI_CONTROL_PRESSED; if (keydata.KeyState.KeyShiftState & EFI_ALT_PRESSED) shift |= EFI_ALT_PRESSED; if (keydata.KeyState.KeyShiftState & EFI_LOGO_PRESSED) shift |= EFI_LOGO_PRESSED; + + /* Shift is not supposed to be reported for keys that can be represented as uppercase + * unicode chars (Shift+f is reported as F instead). Some firmware does it anyway, so + * filter those out. */ + if ((keydata.KeyState.KeyShiftState & EFI_SHIFT_PRESSED) && + keydata.Key.UnicodeChar == 0) + shift |= EFI_SHIFT_PRESSED; } /* 32 bit modifier keys + 16 bit scan code + 16 bit unicode */ |