From patchwork Mon Oct 14 15:46:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 176261 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4682932ill; Mon, 14 Oct 2019 08:46:37 -0700 (PDT) X-Received: by 2002:adf:9bc7:: with SMTP id e7mr28267099wrc.203.1571067997259; Mon, 14 Oct 2019 08:46:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571067997; cv=none; d=google.com; s=arc-20160816; b=b061gwdiNV/bzUNtVn+LKRO6qMn3VQhOM6e5PdlgtilZ8B/tZb3lXQxalUmqhoRw6s rPr3nw4YyAPpa2CLAvSxoYRJXdENmT1IMDDl92h/p7AHYAya7OuE67SAB32G23PoLzUC NZiY5SPdfi4dsc0CTOdp9V+ZeOyDdOlzzT4JUV2X5/Ne4Pcnde4vE84Q2LFCvJpCZiJ3 0xx56/bEGswv5ZY9LGBlGK7/R+cBEVusKgT+4HDKU19AJP0RCSxWC38GvxJh55cIMER9 B9yImgEis+inEjNLtz68S1Zk1egkZeOgXxFllw+scf+a2CyIAL8iIzOzoPdrRVUTMk3O 64vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=1Av3ioNZKtn1IoIkmuPv2cbQ6HyfD+1rS28OweGIOdo=; b=d/OMu2+MtGOYI4BJF1W7s+kR3DxamRGa2+yvHQtJreWFBRa9EIgARC46HiFNDoIAAO jzHixsfHFJsFwCxuViywkPHOZXma+BlN0Dqnt0tSQKp1xPzJNYT6zk/0ACpmugVuqB0f Sg4xMFmF3Mt6GZObh3gfprd3AHN4UYMiQg0qSM9/HyrOi5WircKVKIBLWdwnmvSiaAEY dGdzqoLax9e0dDC6CQO/pZYFt86yj8PXImpKR+wxnU06jl+zssLOSHQwsWreCE8KxsB1 5rZkahN6yp0d4e015b9sbOQD9YshBEgIAse+DYJDqvMcj1e7dCDURSXyaIABIzwIut+M j1gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YM1MA4Ug; spf=pass (google.com: domain of daniel.thompson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=daniel.thompson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id i8sor12270030wrp.3.2019.10.14.08.46.37 for (Google Transport Security); Mon, 14 Oct 2019 08:46:37 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YM1MA4Ug; spf=pass (google.com: domain of daniel.thompson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=daniel.thompson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1Av3ioNZKtn1IoIkmuPv2cbQ6HyfD+1rS28OweGIOdo=; b=YM1MA4Ug496qhJG5JvBKwtecmdfgxLvwt5inayWrP/lErf4KHykJ7C09zxlGL0sWGR 0BnL+DDPzZ1Ou6v+pY6BgmI+BkfA78ismkjLcC6D2QSxNMhAOLEdIMUDYx5gQLr652V1 uVl2mEp4TXv7sAqmay1F1z/HsX4N4Sr0bs6/d5bYPqBsaHPxgjSDzqufNnCbIUMpKGCp 1ElUPBkbaWpiV8m2jBrqZCkeNk+J4bHJvy0gNwI/KQy3DQ6D+mmqKgIr+F1qwg6I9LOK 9ddvnBHnmgIdnTjWTelfyj2NDxWX2akx+aLMXaYRmYL+10Vwxzpb0Y+5um9HeV4sSNYz hm/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1Av3ioNZKtn1IoIkmuPv2cbQ6HyfD+1rS28OweGIOdo=; b=r9Mt3c0Bh8mk2Qj6xVcGmkU8xeLGlD51gVXKqObUe8D4VWVptBtX85iQZ+ir7U4hT5 ze2wxSg9IWgAI4cigdbHzqSLrRwpYy8Menjt6SYwQmyiMocEGKtgzmotFj2RsY2ze2nH zOp88GEoxV+3ZZxpEzVJsuJdAnjH6a3hTmeHpXr2+Rm2L6LTW40PBVaudMeS2shQ1tYZ TuV320GjJCPRpJf4d/Pu+NQYhGHunM8B1Okayo7cGsou1H3fAfx2z6G+9m3sEuKH/YkQ 93hlPqrTAtx5Y+fkhDmhPb7ggkydA+zqNnpTwSBtW9ngF5Ovq/jIo2C72zyan8guXZIs vTDw== X-Gm-Message-State: APjAAAVSypuprnBY2mhTgyZysXrtiUrsOuLpxjtp3B8/Roflt2qiyMu+ sURjNH2EiM5+RKUw6KXNJxjCT98i X-Google-Smtp-Source: APXvYqzYJrKpnk39yJydikl6aLQWQKXotCoJvyK9bK+1KGh5xXAPc24eb58KOqbLaiBk+LpAw9+nCQ== X-Received: by 2002:a5d:5271:: with SMTP id l17mr27011147wrc.19.1571067996855; Mon, 14 Oct 2019 08:46:36 -0700 (PDT) Return-Path: Received: from wychelm.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id q22sm16539738wmj.5.2019.10.14.08.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 08:46:36 -0700 (PDT) From: Daniel Thompson To: Jason Wessel , Douglas Anderson Cc: Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH v3 5/5] kdb: Tweak escape handling for vi users Date: Mon, 14 Oct 2019 16:46:26 +0100 Message-Id: <20191014154626.351-6-daniel.thompson@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191014154626.351-1-daniel.thompson@linaro.org> References: <20191014154626.351-1-daniel.thompson@linaro.org> MIME-Version: 1.0 Currently if sequences such as "\ehelp\r" are delivered to the console then the h gets eaten by the escape handling code. Since pressing escape becomes something of a nervous twitch for vi users (and that escape doesn't have much effect at a shell prompt) it is more helpful to emit the 'h' than the '\e'. We don't simply choose to emit the final character for all escape sequences since that will do odd things for unsupported escape sequences (in other words we retain the existing behaviour once we see '\e['). Signed-off-by: Daniel Thompson --- kernel/debug/kdb/kdb_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.21.0 Reviewed-by: Douglas Anderson diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index f9839566c7d6..5e71bb2596ed 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -161,8 +161,8 @@ char kdb_getchar(void) *pbuf++ = key; key = kdb_handle_escape(buf, pbuf - buf); - if (key < 0) /* no escape sequence; return first character */ - return buf[0]; + if (key < 0) /* no escape sequence; return best character */ + return buf[pbuf - buf == 2 ? 1 : 0]; if (key > 0) return key; }