diff mbox series

[U-Boot,1/1,for,v2018.03] efi_loader: correct input of special keys

Message ID 20180218212251.13704-1-xypron.glpk@gmx.de
State Superseded, archived
Delegated to: Alexander Graf
Headers show
Series [U-Boot,1/1,for,v2018.03] efi_loader: correct input of special keys | expand

Commit Message

Heinrich Schuchardt Feb. 18, 2018, 9:22 p.m. UTC
Don't set unicode_char if scan_code is set.
Without this correction navigation in the iPXE menu is not possible.

Add support for page up, page down, and insert.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 lib/efi_loader/efi_console.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index d35893dc2a..b5704fbf0f 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -411,14 +411,30 @@  static efi_status_t EFIAPI efi_cin_read_key_stroke(
 				pressed_key.scan_code = getc() - '0' + 11;
 				getc();
 				break;
-			case '2': /* F9 - F12 */
-				pressed_key.scan_code = getc() - '0' + 19;
-				getc();
+			case '2':
+				ch = getc();
+				switch (ch) {
+				case '~': /* INS */
+					pressed_key.scan_code = 7;
+					break;
+				case '1'...'4': /* F9 - F12 */
+					pressed_key.scan_code = ch - '0' + 19;
+					getc();
+					break;
+				}
 				break;
 			case '3': /* DEL */
 				pressed_key.scan_code = 8;
 				getc();
 				break;
+			case '5': /* PG UP */
+				pressed_key.scan_code = 9;
+				getc();
+				break;
+			case '6': /* PG DOWN */
+				pressed_key.scan_code = 10;
+				getc();
+				break;
 			}
 			break;
 		}
@@ -426,7 +442,8 @@  static efi_status_t EFIAPI efi_cin_read_key_stroke(
 		/* Backspace */
 		ch = 0x08;
 	}
-	pressed_key.unicode_char = ch;
+	if (!pressed_key.scan_code)
+		pressed_key.unicode_char = ch;
 	*key = pressed_key;
 
 	return EFI_EXIT(EFI_SUCCESS);