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

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Feb 18 21:22:51 UTC 2018


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 at gmx.de>
---
 lib/efi_loader/efi_console.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

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);
-- 
2.14.2



More information about the U-Boot mailing list