From patchwork Fri Feb 2 06:55:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 195637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp250756dyc; Thu, 1 Feb 2024 22:57:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFd2YraBwJTX4RdPA6TKgZQ5sKsWjjDXOUWrmA9+bzDmnkQksaMGH+irth/0zTufYkFKwS X-Received: by 2002:a05:622a:552:b0:42b:e033:f6e6 with SMTP id m18-20020a05622a055200b0042be033f6e6mr7674046qtx.39.1706857026691; Thu, 01 Feb 2024 22:57:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706857026; cv=pass; d=google.com; s=arc-20160816; b=ga4qRZlasY4naQRqQtMQVRXqlNFxGEYn1MRVl7PNgu6tXUlvqPQCDmpKLZKvWy30gf oEPJICg9EUzzG+w7J5kvdh8UqxzjzmH9DrZF26HYsQVPOgnZzOqtc9h7e0ZvuifrSOVO buWeHFGMewaedMyU+dPbS+8zznouPKoQiTCUkUs9Hv0UW13aTbxZSLpchxagxc0Xm7oE i4aYEXeayId/mDJRQLIOaC5PaeqtP7oOYLFhk4mNo0P9X58r+2prJ2aNcj37USpMTESr 0yh9UAUV3FyFGInGUh7pOk4xUooBvpXl4xYK+LhUjDOfQagQfpmZqpwnJI32fYls2YLh nmLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4Tu11sL3RzCltrBBeV2plxqPs13YIey5PaOhIGPwlk4=; fh=XQdcV0EUUJtMfmHe4W0fupun3XN1TmIYMU1BNKcN9Gs=; b=NYH/A9BA09nzhHFltbStyPSk2wOol6X1GWyqyJickgAFl3PCa5dHIhX0c9eGSzJ44T 1vI38QhPmGDvrqqE31n72dn9vALcNJVY1xFDr0nYEERkf5fpDxqW2l8iMW9M3Vpr2Kor 1Gwju66QYrN99onbHIpJgv/yXHvV5whTqwxaKacwg4k0XF2Wms9d6wff/+8PWX9wwkum ELero+NgIYIcjKDrrMnuRqSZ1MXhPEryY9YhMMfbqUnCnAp4Pk5NYu/FOqctIdCfhAs6 aqohikUllALsS8NrKR3TcpvIz49N+RRJ8rHR8Tj/FmbYfTu1rxVwcWM6RCtvy4u6uT3Q VZHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aAi+ARWj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49317-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49317-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXa3LODlOQhT+4iUScQJfiD8mF4/2MDMMVOiEGqJ8KnuB8l8HDWWURg+O8bmO2KCZZTcubbx3soqcx6LomPa4Puey8qHA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g4-20020ac85804000000b0042a99009af6si1395812qtg.222.2024.02.01.22.57.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:57:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49317-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aAi+ARWj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49317-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49317-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7BAF11C21784 for ; Fri, 2 Feb 2024 06:57:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D16218029; Fri, 2 Feb 2024 06:56:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aAi+ARWj" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D97617BC2; Fri, 2 Feb 2024 06:56:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706856975; cv=none; b=rQz3W/DLH1cEQ6MM1TSL5ZdLf+z6mMtxkkmzeeGUtf7n1fyMJHc86K+aKFbgIEsADIkyzbdVhngRZhm+kI2mft9eNXQB94iGsmy5/YOFtsO331ENt8ZPUGRCbgmM75yazSrEcj64UNEGNgfXyz1hjyG3q6GAwdL4saYMpG/e/zw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706856975; c=relaxed/simple; bh=kxVDTHfZGYZb1zilvgP1SsL8GjUUvmxkdEFoPyB4ugg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PVOkGG9xoq2T2AniGVc2EBvrZngB13JzYhJX0NGE8wh/8m9gBrbtluYj3c/lqVvrlRJbICOGuGKyTT/Jhqt21DAlvP8VYRj7BH0nLdsAI+1iwSepgiEiKJxCc5pU4PNKmfFbZtNkziDCD5dB4vZynqccRI3zTS3g2Yguauu6ZH0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aAi+ARWj; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED070C43390; Fri, 2 Feb 2024 06:56:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706856975; bh=kxVDTHfZGYZb1zilvgP1SsL8GjUUvmxkdEFoPyB4ugg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aAi+ARWjnWruG7yFiXNTUS1zzRsHbEUEzLZLEhgham7+Hk/8XBDZus9sRBcDUjVso UtTW5nuy1N/hxCu8RVPkH4vp2uMVLoWMgE7gxYv09d1nWI/1l3dPs1ahIETRG/IY5R uQx70vnQ4+Ocz5OgYV8F/D+nnz7tEpB6pAyjFLFYzFj4toEEEB6zcpQZ7ZCs/6zWYI ur5cRCAHt0tPvym0Rl0OLtCffzB54KtIa3No1nnl9oUUQ4ZwwfpUVOHFqQYs8p6ZaK poU87oHLdFuxSte1dHCRUIpj/NbzTRnWMxPO7kr7iETqNGPeqNyHUMXsdEq4hj4hEp rb5mT/DnV3zCg== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" Subject: [PATCH 02/22] tty: vt: define enums for CSI+h/l codes Date: Fri, 2 Feb 2024 07:55:48 +0100 Message-ID: <20240202065608.14019-3-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240202065608.14019-1-jirislaby@kernel.org> References: <20240202065608.14019-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789769313499837446 X-GMAIL-MSGID: 1789769313499837446 Decrypt the constant values by proper enum names. This time in set_mode(). Define two of them as DEC ('CSI ?') is about to be split away in the next patches. Signed-off-by: Jiri Slaby (SUSE) --- drivers/tty/vt/vt.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 7d42f148559a..7b55d87248f8 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -1862,6 +1862,24 @@ int mouse_reporting(void) return vc_cons[fg_console].d->vc_report_mouse; } +enum { + CSI_DEC_hl_CURSOR_KEYS = 1, /* CKM: cursor keys send ^[Ox/^[[x */ + CSI_DEC_hl_132_COLUMNS = 3, /* COLM: 80/132 mode switch */ + CSI_DEC_hl_REVERSE_VIDEO = 5, /* SCNM */ + CSI_DEC_hl_ORIGIN_MODE = 6, /* OM: origin relative/absolute */ + CSI_DEC_hl_AUTOWRAP = 7, /* AWM */ + CSI_DEC_hl_AUTOREPEAT = 8, /* ARM */ + CSI_DEC_hl_MOUSE_X10 = 9, + CSI_DEC_hl_SHOW_CURSOR = 25, /* TCEM */ + CSI_DEC_hl_MOUSE_VT200 = 1000, +}; + +enum { + CSI_hl_DISPLAY_CTRL = 3, /* handle ansi control chars */ + CSI_hl_INSERT = 4, /* IRM: insert/replace */ + CSI_hl_AUTO_NL = 20, /* LNM: Enter == CrLf/Lf */ +}; + /* console_lock is held */ static void set_mode(struct vc_data *vc, int on_off) { @@ -1870,20 +1888,20 @@ static void set_mode(struct vc_data *vc, int on_off) for (i = 0; i <= vc->vc_npar; i++) if (vc->vc_priv == EPdec) { switch(vc->vc_par[i]) { /* DEC private modes set/reset */ - case 1: /* Cursor keys send ^[Ox/^[[x */ + case CSI_DEC_hl_CURSOR_KEYS: if (on_off) set_kbd(vc, decckm); else clr_kbd(vc, decckm); break; - case 3: /* 80/132 mode switch unimplemented */ + case CSI_DEC_hl_132_COLUMNS: /* unimplemented */ #if 0 vc_resize(deccolm ? 132 : 80, vc->vc_rows); /* this alone does not suffice; some user mode utility has to change the hardware regs */ #endif break; - case 5: /* Inverted screen on/off */ + case CSI_DEC_hl_REVERSE_VIDEO: if (vc->vc_decscnm != on_off) { vc->vc_decscnm = on_off; invert_screen(vc, 0, @@ -1892,38 +1910,38 @@ static void set_mode(struct vc_data *vc, int on_off) update_attr(vc); } break; - case 6: /* Origin relative/absolute */ + case CSI_DEC_hl_ORIGIN_MODE: vc->vc_decom = on_off; gotoxay(vc, 0, 0); break; - case 7: /* Autowrap on/off */ + case CSI_DEC_hl_AUTOWRAP: vc->vc_decawm = on_off; break; - case 8: /* Autorepeat on/off */ + case CSI_DEC_hl_AUTOREPEAT: if (on_off) set_kbd(vc, decarm); else clr_kbd(vc, decarm); break; - case 9: + case CSI_DEC_hl_MOUSE_X10: vc->vc_report_mouse = on_off ? 1 : 0; break; - case 25: /* Cursor on/off */ + case CSI_DEC_hl_SHOW_CURSOR: vc->vc_deccm = on_off; break; - case 1000: + case CSI_DEC_hl_MOUSE_VT200: vc->vc_report_mouse = on_off ? 2 : 0; break; } } else { switch(vc->vc_par[i]) { /* ANSI modes set/reset */ - case 3: /* Monitor (display ctrls) */ + case CSI_hl_DISPLAY_CTRL: vc->vc_disp_ctrl = on_off; break; - case 4: /* Insert Mode on/off */ + case CSI_hl_INSERT: vc->vc_decim = on_off; break; - case 20: /* Lf, Enter == CrLf/Lf */ + case CSI_hl_AUTO_NL: if (on_off) set_kbd(vc, lnm); else