diff mbox

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

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

Commit Message

Roy Franz July 6, 2015, 11:04 p.m. UTC
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(-)

Comments

Ard Biesheuvel July 7, 2015, 1:10 p.m. UTC | #1
On 7 July 2015 at 01:04, Roy Franz <roy.franz@linaro.org> wrote:
> 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

Order is wrong ^^^

Other than that
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> 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;
> --
> 2.1.4
>

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
diff mbox

Patch

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;