public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Brian J. Johnson" <bjohnson@sgi.com>
To: edk2-devel@lists.01.org
Cc: "Brian J. Johnson" <bjohnson@sgi.com>,
	Feng Tian <feng.tian@intel.com>, Star Zeng <star.zeng@intel.com>
Subject: [PATCH 3/3] MdeModulePkg/TerminalDxe: Handle more keys with TtyTerm
Date: Fri,  7 Oct 2016 09:54:00 -0500	[thread overview]
Message-ID: <f1c02f9f1ea591126cc9c567440ad64ed49e2462.1475849212.git.bjohnson@sgi.com> (raw)
In-Reply-To: <cover.1475849212.git.bjohnson@sgi.com>
In-Reply-To: <cover.1475849212.git.bjohnson@sgi.com>

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 <kyroberts@sgi.com>
Signed-off-by: Brian Johnson <bjohnson@sgi.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
---
 .../Universal/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 3be877b..5c3ea86 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.<BR>
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.<BR>
 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.7.4



  parent reply	other threads:[~2016-10-07 14:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07 14:53 [PATCH 0/3] MdeModulePkg/TerminalDxe: TtyTerm improvements Brian J. Johnson
2016-10-07 14:53 ` [PATCH 1/3] MdeModulePkg/TerminalDxe: Improve TtyTerm cursor position tracking Brian J. Johnson
2016-10-07 14:53 ` [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyTerm cursor motion Brian J. Johnson
2016-10-27  3:09   ` Kinney, Michael D
2016-10-27  5:06     ` Tian, Feng
2016-10-27 18:06     ` Brian J. Johnson
2016-10-27 18:14       ` Kinney, Michael D
2016-10-27 18:32         ` Kinney, Michael D
2016-10-07 14:54 ` Brian J. Johnson [this message]
2016-10-14 20:53   ` [PATCH 3/3] MdeModulePkg/TerminalDxe: Handle more keys with TtyTerm Roy Franz (HPE)
2016-10-07 15:56 ` [PATCH 0/3] MdeModulePkg/TerminalDxe: TtyTerm improvements Laszlo Ersek
2016-10-07 15:59   ` Leif Lindholm
2016-10-12  8:17     ` Ryan Harkin
2016-10-14 19:39       ` Brian J. Johnson
2016-10-14 20:37         ` Laszlo Ersek
2016-10-18 15:34           ` Brian J. Johnson
2016-10-26 15:00             ` Brian J. Johnson
2016-10-27  1:01               ` Tian, Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f1c02f9f1ea591126cc9c567440ad64ed49e2462.1475849212.git.bjohnson@sgi.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox