Skip to contentSkip to conversation

EFI: console: Fix the "enter" key not working on X86 tablets

PATCH In review Hans de Goede 2 participants 2 messages Jun 26, 2018 – Jul 4, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 EFI: console: Fix the "enter" key not working on X86 tablets

Most 8" or 7" x86 Windows 10 tablets come with volume up/down buttons and a power-button. In their UEFI these are almost always mapped to arrow up/down and enter.

Pressing the volume buttons (sometimes by accident) will stop the menu countdown, but the power-button / "enter" key was not being recognized as enter, so the user would be stuck at the grub menu.

The problem is that these tablets send scan_code 13 or 0x0d for the power-button, which officialy maps to the F3 key. They also set unicode_char to 0x0d.

This commit recognizes the special case of both scan_code and unicode_char being set to 0x0d and treats this as an enter key press.

This fixes things getting stuck at the grub-menu and allows the user to choice a grub-menu entry using the buttons on the tablet.

---
 grub-core/term/efi/console.c | 3 +++
 1 file changed, 3 insertions(+)
grub-core/term/efi/console.c +3 -0
index 02f64ea74..1867bad1a 100644
@@ -122,6 +122,9 @@ grub_efi_translate_key (grub_efi_input_key_t key)
       else
 	return key.unicode_char;
     }
+  /* Some devices send enter with scan_code 0x0d (F3) and unicode_char 0x0d */
+  else if (key.scan_code == '\r' && key.unicode_char == '\r')
+    return key.unicode_char;
   else if (key.scan_code < ARRAY_SIZE (efi_codes))
     return efi_codes[key.scan_code];
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Hans de Goede

Most 8" or 7" x86 Windows 10 tablets come with volume up/down buttons and a power-button. In their UEFI these are almost always mapped to arrow up/down and enter.

Pressing the volume buttons (sometimes by accident) will stop the menu countdown, but the power-button / "enter" key was not being recognized as enter, so the user would be stuck at the grub menu.

The problem is that these tablets send scan_code 13 or 0x0d for the power-button, which officialy maps to the F3 key. They also set unicode_char to 0x0d.

Quoted 7 lines

This commit recognizes the special case of both scan_code and unicode_char being set to 0x0d and treats this as an enter key press.

This fixes things getting stuck at the grub-menu and allows the user to choice a grub-menu entry using the buttons on the tablet.

If there are no objections I will apply this in a week or so.

Daniel