From patchwork Tue Oct 8 13:20:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 175498 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp5695343ill; Tue, 8 Oct 2019 06:21:05 -0700 (PDT) X-Received: by 2002:adf:ed12:: with SMTP id a18mr7784584wro.270.1570540865676; Tue, 08 Oct 2019 06:21:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570540865; cv=none; d=google.com; s=arc-20160816; b=nDWXL0XDUtS5HWfOru3fwSBVEMT8n+h6uG/olHWNn0vrUNiX/kKQWcKpgNC2YESREz +bCKBU26maKOU4GhH9r+r+6veBG6DJzzFRfxAVCCegn7bDt2g4D74kYtu2ztnZ4LOPM5 bDDOs9DaHbygcWH0xRJ2q5Esao0GukqEYPQ8cxm+TR2S7RBNySfQhw+cTdWeZ7sjH78h eF1iXRnk/h0ELgvG+ihn9IWVOwIHW5j4DAc+Igo9eHofnQ0cWVLwrg+Qqvzw0MbiksNW oAbxys9ICQQ6SPLoOy2EfHDGgy31WLgecTNhAfHAHAm0Stp2msFa+PKPirkK/gffbm44 aPCA== 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=4kY29G0Vv0LUgp77TY4nev0SFuE29dpeYRm9kekwuAs=; b=rGDchN9P9/7Wng1pXbbHnWeYF/NuIvHiiKv8L1JomdAcOTu5/owpBPZoi+lAj6DEBS ATAfmzUvK2X6J7y/f390MxAgqubyCvd5wcEFWRAPAwK4G3FxWk4UcZuwDcVPXv2c5k25 cotTdC8UUtpccdrRPZUz/PLtcvMkmPlCNCZVUxaSU+J+jQSNLZHR9E+P75NDdvdpxTn5 M+zIzBfZ97cz1utvBtMHn3ZzySb+gINdxjoZX1vuz+Gbbus0+Qj0+s81llyzFMlg871u Bji0w/dPFvgg4XzzaUeeQdOz/8xoWw/yz7jJCyYd4vit/zyiPJwl5Bk+ErTdO/r2fVji Hy3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y8G5bARZ; 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 k6sor11983438wrx.6.2019.10.08.06.21.05 for (Google Transport Security); Tue, 08 Oct 2019 06:21:05 -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=y8G5bARZ; 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=4kY29G0Vv0LUgp77TY4nev0SFuE29dpeYRm9kekwuAs=; b=y8G5bARZUMAphF+R/07LfBMyRQOM3WLFLZtB1WmAPqNPLZIXJUU3T+n8svaRVbVXXu fSX0iRlglv3HdI9U7Q0BG/VcvMgxpjLBtlcMUoDlKX06EOjfoI1Yy8KUHuOqyo2WjWP3 1BlNGvTlBgy1WaIf/OMofwgZxax85EDM4giKt1zHyXq8VvaKWpNU8TCcjlngahA/3rTG S6474/ShvWl1Qkw5H2YS++NelF3P9nlTN39EfmLrVTqDDDQvTHEXoXxFWPU8oc323mrS 0rCULt0aSfd+5qQPPs2jb+P37REdOfPhBv4VM663cw+IxpEopgie9YBNUsxqMIiyf766 b4ww== 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=4kY29G0Vv0LUgp77TY4nev0SFuE29dpeYRm9kekwuAs=; b=HF0d+CbPbBJRSzD39C8Mcv6G7ZGAGs7SYVs0vN06Ju7Bz6ialwWfj+0xobwMKVYODN KDk1GCXHQJ8r2DLHiY44xyYSUHQo4QyrSsMeq8oBInUJQlUSCAOPCDiuBhhTblQ5xvro Aie9sfzMDNlofXauM+A+tPDUvR7j60j2yExUQR+1BhLI7OTXnMNvf6/gcPzJmbLR2cLv yjHGZ05774OUogboV0Maw4nj+fZtAKSXu6TH8ict1ubRCsCU2JtxRo7IZmOGl7wJsTUf oXz7FtFzzs5Q6QVIn16ujTpfMB6gNfSoXETo8NHfW/Si4zadtgsbnt4JyTuD2NxCRR0N 8itQ== X-Gm-Message-State: APjAAAVF+rF7rUEUoZDxCk1B/xnOM9Kw+YYud2m5hGXXBJMw0TTaiUKo JbO5b0cecZUXGwqf0fqmX8OCQ57Q X-Google-Smtp-Source: APXvYqxNmkd7+lu3m5HT68bq8+K8jXZJIhwyxO8fds7XHqED0zcAr0wrmRONAo9NJoIqfRGy4qAdMA== X-Received: by 2002:adf:f684:: with SMTP id v4mr24398220wrp.155.1570540865110; Tue, 08 Oct 2019 06:21:05 -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 t8sm18237214wrx.76.2019.10.08.06.21.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2019 06:21:04 -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 v2 5/5] kdb: Tweak escape handling for vi users Date: Tue, 8 Oct 2019 14:20:43 +0100 Message-Id: <20191008132043.7966-6-daniel.thompson@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191008132043.7966-1-daniel.thompson@linaro.org> References: <20191008132043.7966-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 diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 288dd1babf90..b3fb88b1ee34 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -158,8 +158,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; }