Hello all,

I haven't been able to type the passphrase of my softraid device on boot when 
using an external keyboard on my Thinkpad X260. Finally I had some time to 
debug this problem and this is what I discovered.

On a different laptop with EFI, the ReadKeyStroke call will not return a packet 
when shift is pressed on the external keyboard. On the Thinkpad however, a 
packet is returned with UnicodeChar == 0, which results in a wrong passphrase 
being used.

This seems like a bug in the firmware to me, because according to some EFI 
specifications I found online, this should not return a packet. I've attached a 
simple patch that fixes this, but I'm not sure whether this might break things 
on different systems.

--
Frank
Index: efiboot.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/efiboot.c,v
retrieving revision 1.30
diff -u -p -r1.30 efiboot.c
--- efiboot.c	6 Jul 2018 07:55:50 -0000	1.30
+++ efiboot.c	16 Aug 2018 19:44:50 -0000
@@ -494,7 +494,7 @@ efi_cons_getc(dev_t dev)
 	}
 
 	status = EFI_CALL(conin->ReadKeyStroke, conin, &key);
-	while (status == EFI_NOT_READY) {
+	while (status == EFI_NOT_READY || key.UnicodeChar == 0) {
 		if (dev & 0x80)
 			return (0);
 		EFI_CALL(BS->WaitForEvent, 1, &conin->WaitForKey, &dummy);

Reply via email to