From 1df81f6d144aad7340fda1c90f622c4b234b3492 Mon Sep 17 00:00:00 2001 From: "Brian J. Johnson" Date: Fri, 7 Oct 2016 22:54:00 +0800 Subject: [PATCH] MdeModulePkg/TerminalDxe: Handle more keys with TtyTerm The TtyTerm terminal driver is missing support for sequences produced by the page up, page down, insert, home, and end keys in some terimnal emulators. Add them. Tested under Ubuntu 16.04 using xterm 322-1ubuntu1, GNOME terminal 3.18.3-1ubuntu1, and XFCE terminal 0.6.3-2ubuntu1. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Kyle Roberts Signed-off-by: Brian Johnson Cc: Feng Tian Cc: Star Zeng Reviewed-by: Roy Franz Tested-by: Ryan Harkin Reviewed-by: Feng Tian --- .../Console/TerminalDxe/TerminalConIn.c | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c index 3be877b466..5c3ea86fe1 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c @@ -3,6 +3,7 @@ (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1374,7 +1375,7 @@ UnicodeToEfiKey ( break; } } else if (TerminalDevice->TerminalType == TTYTERMTYPE) { - /* Also accept VT100 escape codes for F1-F4 for TTY term */ + /* Also accept VT100 escape codes for F1-F4, HOME and END for TTY term */ switch (UnicodeChar) { case 'P': Key.ScanCode = SCAN_F1; @@ -1388,6 +1389,12 @@ UnicodeToEfiKey ( case 'S': Key.ScanCode = SCAN_F4; break; + case 'H': + Key.ScanCode = SCAN_HOME; + break; + case 'F': + Key.ScanCode = SCAN_END; + break; } } @@ -1429,12 +1436,14 @@ UnicodeToEfiKey ( break; case 'H': if (TerminalDevice->TerminalType == PCANSITYPE || - TerminalDevice->TerminalType == VT100TYPE) { + TerminalDevice->TerminalType == VT100TYPE || + TerminalDevice->TerminalType == TTYTERMTYPE) { Key.ScanCode = SCAN_HOME; } break; case 'F': - if (TerminalDevice->TerminalType == PCANSITYPE) { + if (TerminalDevice->TerminalType == PCANSITYPE || + TerminalDevice->TerminalType == TTYTERMTYPE) { Key.ScanCode = SCAN_END; } break; @@ -1573,9 +1582,18 @@ UnicodeToEfiKey ( TerminalDevice->TtyEscapeStr[TerminalDevice->TtyEscapeIndex] = 0; /* Terminate string */ EscCode = (UINT16) StrDecimalToUintn(TerminalDevice->TtyEscapeStr); switch (EscCode) { + case 2: + Key.ScanCode = SCAN_INSERT; + break; case 3: Key.ScanCode = SCAN_DELETE; break; + case 5: + Key.ScanCode = SCAN_PAGE_UP; + break; + case 6: + Key.ScanCode = SCAN_PAGE_DOWN; + break; case 11: case 12: case 13: -- 2.39.2