From patchwork Fri Aug 31 20:51:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 145703 Delivered-To: patches@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1217137ljw; Fri, 31 Aug 2018 13:52:36 -0700 (PDT) X-Received: by 2002:a1c:6a06:: with SMTP id f6-v6mr5476830wmc.159.1535748756314; Fri, 31 Aug 2018 13:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535748756; cv=none; d=google.com; s=arc-20160816; b=kogB9SPR5WgVU8iW7A7mb4IxifC/nXTEKnKiehItkUGboadd9dYNdXGOe6isr4nB9P QAlPOygC2OSM9MSLtQ0z9bDxa47Eg2YwK8lSm6WtZ3FhjlmPo72IQmZnJ6CxEGE29Exk CZ4coTJczdtxclAKU1ZHqGCvbmz3S1cGyVyH9Mwofy58vSst0hVrjq95SOngpUsHzUos 9cbtrTj6yD8LMxeoSi0Du4AEpYkU7OWZMVoRKCrkacSg58s+hmzrFBXvAs0ykCkDo+KW LS7flDwv3uxFWq4yWvAJNf6PZBjro0WglZlZgmhh5rWg4Z1AC/8I88Kavf94zV2fk4xR 6czg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=LFaXeC2Evd+DuiB5BQjy+jnfA9tN+/uH8Nu3cT+zAnw=; b=kx4g722909mYbTnyJ7cvHkat98kZVmNzJpviJx+7x6W3MO95jU7U9k8EAxb7hfDpnM sRno2O+K0O2PO/5Nr/040v7zYgxEF0vMSXX4h9mVlhRd9NqVOj2Xad19Jadwd9HA/dJ8 zFMi/bi5KvODgdiThIztvMvn3vA8YMPJpAQ4CPtQW8bZShcPIhHfOL3HGLa+Oi238ney XbAEskjoUle2pK2X60srZCNw8sZIh7hIMXgUD2U3iY9iP4uzNB+4/F/CWtEl4w6RqaKH JVB8f/yfaT40vSVmkjAFg0uiZ66hzVLTFWpetwKd4zSCLJhyBStW+EZUa4FYjO7OtOX8 FWig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UWAhmCQg; 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 h7-v6sor7706045wru.5.2018.08.31.13.52.36 for (Google Transport Security); Fri, 31 Aug 2018 13:52:36 -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=UWAhmCQg; 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; bh=LFaXeC2Evd+DuiB5BQjy+jnfA9tN+/uH8Nu3cT+zAnw=; b=UWAhmCQgMm/puX4vhN8WFvN8sLKez0w4aDfF1gQeVxVXxl/pbuZ25gNl4oGBKWfa8g o3as7YkCKXgtPdGsut7Ym5b675w8f8MjhecIrEeFJ88zH66zSzSXlRUHYM+79Vup4ERs Z3z5bWDdh9hflFp6HMc9R3Vu1qbOQX5S7SnM8= 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; bh=LFaXeC2Evd+DuiB5BQjy+jnfA9tN+/uH8Nu3cT+zAnw=; b=fXjMyKZn/pVgxYwIXMzXHtDb6hvXxvw14Ixq9xnMwlWhZ6J2S6BCWDJz2928kjGWmJ NnqMPGBIQ0D8OskElyBn33BtsDP8jcvZdqX0K12SXJBIfhX672q1jnPZYRsMaXsKk90F G2kd1/73w7lL+V8IzEJ3qmRNRoPgJL+UkoWs9MaYoQMEfoHBKPzaX809Xu2fA4EJ55/y qSLazAcUfVZEhBd8oSBkugLgXrTkCtkx9nLvkhpaUW500uE6gjB2rYnfINu+YVQIqcU/ raIv6Oj7Ld4+1OAUotYJR5XHBjMDgcvNv/BYYmE77AR+U+SlRKaxAKcA7JDv1SdJlm7c ju4g== X-Gm-Message-State: APzg51C1/4lrOlPv7fq7UwLjtewNVgLt/FFa12tQPKuO7ECid2Q1epUK F77UrqZFjXY0V+CPuDF8F9LP/lLG X-Google-Smtp-Source: ANB0VdZ1SDbAM8r/SmaYtxqLtwonYoylLFOLV89JnQL79LGX+Sppq5t/G+URUogD5AB5MSFqj6IcGg== X-Received: by 2002:adf:9c12:: with SMTP id f18-v6mr12578275wrc.93.1535748756069; Fri, 31 Aug 2018 13:52: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 u4-v6sm7659356wro.47.2018.08.31.13.52.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 31 Aug 2018 13:52:35 -0700 (PDT) From: Daniel Thompson To: Jason Wessel Cc: Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH 5/5] kdb: Tweak escape handling for vi users Date: Fri, 31 Aug 2018 21:51:42 +0100 Message-Id: <20180831205142.23609-6-daniel.thompson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180831205142.23609-1-daniel.thompson@linaro.org> References: <20180831205142.23609-1-daniel.thompson@linaro.org> 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.17.1 diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 8f2470016250..6ee8f812d656 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -154,8 +154,8 @@ static int kdb_getchar(void) *pbuf++ = key; key = kdb_read_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 ? 0 : 1]; if (key > 0) return key; }