]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Work around broken UEFI keyboard drivers
authorMichael Brown <mcb30@ipxe.org>
Wed, 25 May 2016 14:51:36 +0000 (15:51 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 25 May 2016 22:28:41 +0000 (23:28 +0100)
Some UEFI keyboard drivers are blissfully unaware of the existence of
either Ctrl key, and will report "Ctrl-<key>" as just "<key>".  This
breaks substantial portions of the iPXE user interface.

Work around these broken UEFI drivers by allowing "ESC <key>" to be
used as a substitute for "Ctrl-<key>".

Tested-by: Dreamcat4 <dreamcat4@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/getkey.c

index 0f0f8b7c335a48aefedc2218fea17df9bd6d25cc..0c280d23b77c1560832a0794767ef00d39bc65ce 100644 (file)
@@ -76,9 +76,14 @@ int getkey ( unsigned long timeout ) {
        if ( character != ESC )
                return character;
 
+       character = getchar_timeout ( GETKEY_TIMEOUT );
+       if ( character < 0 )
+               return ESC;
+
+       if ( isalpha ( character ) )
+               return ( toupper ( character ) - 'A' + 1 );
+
        while ( ( character = getchar_timeout ( GETKEY_TIMEOUT ) ) >= 0 ) {
-               if ( character == '[' )
-                       continue;
                if ( isdigit ( character ) ) {
                        n = ( ( n * 10 ) + ( character - '0' ) );
                        continue;