From patchwork Fri Oct 25 07:33:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 177679 Delivered-To: patches@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3286045ill; Fri, 25 Oct 2019 00:33:49 -0700 (PDT) X-Received: by 2002:adf:f306:: with SMTP id i6mr1424523wro.209.1571988829220; Fri, 25 Oct 2019 00:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571988829; cv=none; d=google.com; s=arc-20160816; b=TrdKLUSC2ggb18Bit9XOcHyOiRn6QQ9+vMfToWrUm6q8JSYhdKUvVCNMohYlnE1Urp BEvuIJn2Lfftf/l4CAe2LcfvIhFA1GXhvEQ/Egydq0M4DFdhtorFgHuwxKuxJFetUxHT e4S5EmPGhtdBQ7mC6VzZvsudZ2xmVGxeGm/Tpx7ixb7G8y3EUB7vKBkiN9Ir1m2EU/+N pAQRTN1WdbMKcS/3trj2xsN6s41u2EUb+6g0UxuTHTEwmNyBReFVRAuU0kg3b4GomO0n eEMRCDr1SG1/x7Sb40htcNGPw7TB7xoiTWpuKcxyNp03sFrx4ckQn4Or0oLMf7aI7IaK ttuw== 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=Q37OwpiVtbI5u9x13AdojV2Y5xWX2cctv9qNpKud8OE=; b=ndckHWKoHxxvdHnAJmP0QFLCe3Ci7Sq37FpaSWZVazXC+pkbgekG9/6kAwBL9BbgxQ wKGGpwUwPs63zNU/bdtGfWtXmpz1RHWoPuEPzrAYdrjYUwSirqNDMl9HoXHCzQKhFP6q WagzuuYc/F85pJTlFp2pCnhZEO8C8NCq/GrCHqhonzzZ99bqohX4aW5Nf8InWUkZugi8 y9oXKDQzq1lzNiIv4tVyuE2MqAck25fBUkrdb/eo6lAHp40SP+T80LwH2CND2P8J8U7w bwj2KWILCVvpJVKu3DqiYlKt6KaN4v2wI5QrMzyjfE8ihrBLNaBHd7xtCGQLjH00kLsU oYYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P4LngvYm; 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 a3sor737574wrv.58.2019.10.25.00.33.49 for (Google Transport Security); Fri, 25 Oct 2019 00:33:49 -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=P4LngvYm; 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=Q37OwpiVtbI5u9x13AdojV2Y5xWX2cctv9qNpKud8OE=; b=P4LngvYmSq6jPBLO+72WALO/I5hwPb8wBo/iX++QaE/PGzClMjrelf5trymgeACiL/ YTUcpEXbRYV250IAVK0n1KrbZZ2vDTGOOZ/DFhC10ZjdmHu4t+mfdEEAc8U3RLQOgvpf eTDeWOTe5ETiE4h/Srpkwxp763K0Vjr6b/J51TJzPuHZr1ZBOS3B+hi4ZzCV/MgcQBm1 9Zwm79mjbRVCsi3HBCz5KRqA8fTXJ/NieqY03Zso65gOZJQOeLFaPj7Cmbc+szocGMSD vab+i02s06FO9zY9qYJ2h2W8lCbMo7HLapAZFtjGnfqUuNJYuDVfs+KKClYXNEudclg9 7rRw== 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=Q37OwpiVtbI5u9x13AdojV2Y5xWX2cctv9qNpKud8OE=; b=KZdbSWYMlkyOghvk/NW2xurbgBJYeFzryAEWDqnrNtuz1daxk96B2jUWwS2eg8ppI3 wBK+CwIuLCdZncJ0Ge1pCZCkibwtMD6gc3FpwHHq0YBdJoc2jJSn25YdmDmMiu56nMQ1 6fOFt6u1KdhYGzH+GiPQL3dQZg7LaMo+ySXB3Ai1beWUfAWBfIt03x4QMYYQsSjIyaNK KIKzVwqLvl/76I+aJKg+GrWp8KRWrPcVEWfgsH7yp1TG+lJ2mu4pJpJ/d6Zw3hy180An KMqm1iSHT41tJlqakPDvCaQSFE4obOrBOdlp6cjUfW1aveK6pDMiB6WJFcOcXmyHcrJk H5SA== X-Gm-Message-State: APjAAAV69NXdrUgW4zogJ+cbod3D148oiZwnyo4mVWQHAfAZTiShWs8R 81fPKIGe1mUyOpYmMYhenUl9YaMS X-Google-Smtp-Source: APXvYqxVdg6EGKxAbF8m2sxB498qF0UJFQZ60UmPuvIvhtWcaHsRZj1iamepXusCBxdTqf7khttU6Q== X-Received: by 2002:adf:c402:: with SMTP id v2mr1570013wrf.323.1571988828803; Fri, 25 Oct 2019 00:33:48 -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 a11sm1586602wmh.40.2019.10.25.00.33.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2019 00:33:47 -0700 (PDT) From: Daniel Thompson To: Douglas Anderson , Jason Wessel Cc: Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH v4 5/5] kdb: Tweak escape handling for vi users Date: Fri, 25 Oct 2019 08:33:28 +0100 Message-Id: <20191025073328.643-6-daniel.thompson@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191025073328.643-1-daniel.thompson@linaro.org> References: <20191025073328.643-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 Reviewed-by: Douglas Anderson --- 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 f794c0ca4557..8bcdded5d61f 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -163,8 +163,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; }