[edk2,2/4] Treat ASCII 0x7F as backspace for TtyTerm terminals

Message ID 1435015811-25912-3-git-send-email-roy.franz@linaro.org
State New
Headers show

Commit Message

Roy Franz June 22, 2015, 11:30 p.m.
Treat ASCII 0x7F as backspace, rather than delete, for TTY terminals.  This
better matches the default Linux terminal settings that are used when connecting
to a simulated platform using xterm or a similar terminal program.

Signed-off-by: Roy Franz <roy.franz@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
---
 MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
index 17a1244..227df85 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
@@ -1561,8 +1561,14 @@  UnicodeToEfiKey (
     }
 
     if (UnicodeChar == DEL) {
-      Key.ScanCode    = SCAN_DELETE;
-      Key.UnicodeChar = 0;
+      if (TerminalDevice->TerminalType == TTYTERMTYPE) {
+        Key.ScanCode    = SCAN_NULL;
+        Key.UnicodeChar = CHAR_BACKSPACE;
+      }
+      else {
+        Key.ScanCode    = SCAN_DELETE;
+        Key.UnicodeChar = 0;
+      }
     } else {
       Key.ScanCode    = SCAN_NULL;
       Key.UnicodeChar = UnicodeChar;