From patchwork Mon Jun 22 23:30:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 50196 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DA96921575 for ; Mon, 22 Jun 2015 23:30:54 +0000 (UTC) Received: by wicnd19 with SMTP id nd19sf235987wic.0 for ; Mon, 22 Jun 2015 16:30:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=wLfPadlQG4OuI6Rf/+YHiQiov/7YYRzWV0b0t9Hmm2s=; b=k1zULDMNe0VvmxD91NX+CNJkX2Lw988ZPR0kRUrVmPrOfLJKIjiw76Bj4O+AZOZyb5 ipSMvrb2jMWS5B3YFgb9Qrrbg0fTRhfc02+2EaNH6jD0+biim/YqNqswtX+egLztrefr lQ5aLuvwgAhRC+XJVrRlKF7Qg7ZxN/E1TCorYvdWpLqjPcUF3ei12wmTfnNckQLNdyDZ BJ0nbB33EPfEcuezm861L/SH7PeTa+Y7YVsHDFbOIzzp8SaLoca42jSkxs2iHmaAIvxJ ncXZiTnKMrUD9Kd61eDWd7G81WXpD16/r/U9wnWx1SFD1qxkjs/6pRy0msGzZziDR06w 3seA== X-Gm-Message-State: ALoCoQlFqQG63cmqQ+lfSFa3OwxOJFyrMnx11A8L2tc8NLwYx74EcFrcaA9v4nAWHF6wdL73WdFh X-Received: by 10.112.138.2 with SMTP id qm2mr29611996lbb.19.1435015854165; Mon, 22 Jun 2015 16:30:54 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.163 with SMTP id t3ls1003742lat.6.gmail; Mon, 22 Jun 2015 16:30:54 -0700 (PDT) X-Received: by 10.152.44.166 with SMTP id f6mr32480284lam.86.1435015854017; Mon, 22 Jun 2015 16:30:54 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id pl9si17787572lbb.111.2015.06.22.16.30.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jun 2015 16:30:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by lagx9 with SMTP id x9so31390457lag.1 for ; Mon, 22 Jun 2015 16:30:53 -0700 (PDT) X-Received: by 10.112.209.106 with SMTP id ml10mr31948162lbc.112.1435015853540; Mon, 22 Jun 2015 16:30:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2697025lbb; Mon, 22 Jun 2015 16:30:52 -0700 (PDT) X-Received: by 10.107.15.40 with SMTP id x40mr42853200ioi.0.1435015846227; Mon, 22 Jun 2015 16:30:46 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id n10si10544514igv.28.2015.06.22.16.30.45 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 22 Jun 2015 16:30:46 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Z7BAh-0008O3-W9; Mon, 22 Jun 2015 23:30:35 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Z7BAg-0008Ny-R5 for edk2-devel@lists.sourceforge.net; Mon, 22 Jun 2015 23:30:34 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.192.173 as permitted sender) client-ip=209.85.192.173; envelope-from=roy.franz@linaro.org; helo=mail-pd0-f173.google.com; Received: from mail-pd0-f173.google.com ([209.85.192.173]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1Z7BAf-0008Np-W2 for edk2-devel@lists.sourceforge.net; Mon, 22 Jun 2015 23:30:34 +0000 Received: by pdbki1 with SMTP id ki1so148203435pdb.1 for ; Mon, 22 Jun 2015 16:30:28 -0700 (PDT) X-Received: by 10.70.135.129 with SMTP id ps1mr62771064pdb.110.1435015828408; Mon, 22 Jun 2015 16:30:28 -0700 (PDT) Received: from localhost.localdomain (c-73-41-93-56.hsd1.ca.comcast.net. [73.41.93.56]) by mx.google.com with ESMTPSA id tj8sm21143238pab.30.2015.06.22.16.30.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Jun 2015 16:30:27 -0700 (PDT) From: Roy Franz To: edk2-devel@lists.sourceforge.net, feng.tian@intel.com, lersek@redhat.com, ard.biesheuvel@linaro.org Date: Mon, 22 Jun 2015 16:30:10 -0700 Message-Id: <1435015811-25912-4-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1435015811-25912-1-git-send-email-roy.franz@linaro.org> References: <1435015811-25912-1-git-send-email-roy.franz@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1Z7BAf-0008Np-W2 Subject: [edk2] [PATCH 3/4] accept [3~ as delete for TtyTerm terminals X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: roy.franz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Accept the VT200 escape code [3~ as backspace for TtyTerm terminals. This is sent by many Linux terminals by default. This is the first 3 charactar escape sequency handled, so a new state is added to the escape sequence handling state machine. Signed-off-by: Roy Franz Contributed-under: TianoCore Contribution Agreement 1.0 --- MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h | 1 + MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h index 03542a4..4616ab3 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h @@ -118,6 +118,7 @@ typedef struct { #define INPUT_STATE_LEFTOPENBRACKET 0x04 #define INPUT_STATE_O 0x08 #define INPUT_STATE_2 0x10 +#define INPUT_STATE_LEFTOPENBRACKET_2 0x20 #define RESET_STATE_DEFAULT 0x00 #define RESET_STATE_ESC_R 0x01 diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c index 227df85..7849584 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c @@ -1397,6 +1397,12 @@ UnicodeToEfiKey ( TerminalDevice->TerminalType == VTUTF8TYPE || TerminalDevice->TerminalType == TTYTERMTYPE) { switch (UnicodeChar) { + case '3': + if (TerminalDevice->TerminalType == TTYTERMTYPE) { + TerminalDevice->InputState |= INPUT_STATE_LEFTOPENBRACKET_2; + continue; + } + break; case 'A': Key.ScanCode = SCAN_UP; break; @@ -1527,6 +1533,33 @@ UnicodeToEfiKey ( break; + case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET | INPUT_STATE_LEFTOPENBRACKET_2: + + Key.ScanCode = SCAN_NULL; + + if (TerminalDevice->TerminalType == TTYTERMTYPE) { + switch (UnicodeChar) { + case '~': + Key.ScanCode = SCAN_DELETE; + break; + } + } + + TerminalDevice->ResetState = RESET_STATE_DEFAULT; + + if (Key.ScanCode != SCAN_NULL) { + Key.UnicodeChar = 0; + EfiKeyFiFoInsertOneKey (TerminalDevice, &Key); + TerminalDevice->InputState = INPUT_STATE_DEFAULT; + UnicodeToEfiKeyFlushState (TerminalDevice); + continue; + } + + UnicodeToEfiKeyFlushState (TerminalDevice); + + break; + + default: // // Invalid state. This should never happen.