From patchwork Fri Oct 23 18:52:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1386953 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=Kwzi6vmC; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CHtdl1F7Qz9sSs for ; Sat, 24 Oct 2020 05:52:43 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B158982424; Fri, 23 Oct 2020 20:52:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="Kwzi6vmC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4AA7A82440; Fri, 23 Oct 2020 20:52:36 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B2D2E82369 for ; Fri, 23 Oct 2020 20:52:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1603479151; bh=OzVACZYP8+WwjNry6j2kkt88/9Ti9GFtr1mL+jdL4mY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=Kwzi6vmCITjvzbzfdgDJRywjnJnUudES6i9Sjc9ifYXV0zyxsReANWtLm3y27p3XE XS/XxOwOQ5rvCy/ixptlffTGF2icpONp1/1+Z7bPK6OUxoE8hCzjLkW5pUn6+uk8mk ROA+FnRK7aMZPsmSq1/J2flwxBi/O51RC5xmHoPA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1M5QFB-1kWr7a2voL-001Tg7; Fri, 23 Oct 2020 20:52:31 +0200 From: Heinrich Schuchardt To: Tom Rini Cc: Simon Glass , Bin Meng , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 1/1] input: add support for FN1 - FN10 on crosswire kbd Date: Fri, 23 Oct 2020 20:52:26 +0200 Message-Id: <20201023185226.36589-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:9v+35T8CAD7aN66ce+ITQKX3+LCr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hs6j2MiGqcSEquOi2e1yb4lVscBUSAGZ1t+sF+AdDWeYXGXkUbk2 fNLKSpSsxyKKf1jiYBvA== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Chromebooks and the sandbox use a crosswire keyboard with function keys FN1 - FN10. These keys are needed when running UEFI applications like GRUB or the UEFI SCT. Add support for these keys when translating from key codes to ECMA-48 (or withdrawn ANSI 3.64) escape sequences. All escape sequences start with 0x1b. So we should not repeat this byte in the kbd_to_ansi364 table. For testing use: sandbox_defconfig + CONFIG_EFI_SELFTEST=y $ ./u-boot -D -l => setenv efi_selftest extended text input => bootefi selftest Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- drivers/input/input.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) -- 2.28.0 diff --git a/drivers/input/input.c b/drivers/input/input.c index da264f4166..b6d5f0a160 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -170,21 +170,35 @@ static struct kbd_entry { }; /* - * Scan key code to ANSI 3.64 escape sequence table. This table is - * incomplete in that it does not include all possible extra keys. + * The table contains conversions from scan key codes to ECMA-48 escape + * sequences. The same sequences exist in the withdrawn ANSI 3.64 standard. + * + * As all escape sequences start with 0x1b this byte has been removed. + * + * This table is incomplete in that it does not include all possible extra keys. */ static struct { int kbd_scan_code; char *escape; } kbd_to_ansi364[] = { - { KEY_UP, "\033[A"}, - { KEY_DOWN, "\033[B"}, - { KEY_RIGHT, "\033[C"}, - { KEY_LEFT, "\033[D"}, + { KEY_UP, "[A"}, + { KEY_LEFT, "[D"}, + { KEY_RIGHT, "[C"}, + { KEY_DOWN, "[B"}, + { KEY_F1, "OP"}, + { KEY_F2, "OQ"}, + { KEY_F3, "OR"}, + { KEY_F4, "OS"}, + { KEY_F5, "[15~"}, + { KEY_F6, "[17~"}, + { KEY_F7, "[18~"}, + { KEY_F8, "[19~"}, + { KEY_F9, "[20~"}, + { KEY_F10, "[21~"}, }; /* Maximum number of output characters that an ANSI sequence expands to */ -#define ANSI_CHAR_MAX 3 +#define ANSI_CHAR_MAX 5 static int input_queue_ascii(struct input_config *config, int ch) { @@ -417,6 +431,7 @@ static int input_keycode_to_ansi364(struct input_config *config, for (i = ch_count = 0; i < ARRAY_SIZE(kbd_to_ansi364); i++) { if (keycode != kbd_to_ansi364[i].kbd_scan_code) continue; + output_ch[ch_count++] = 0x1b; for (escape = kbd_to_ansi364[i].escape; *escape; escape++) { if (ch_count < max_chars) output_ch[ch_count] = *escape; @@ -473,7 +488,7 @@ static int input_keycodes_to_ascii(struct input_config *config, /* Start conversion by looking for the first new keycode (by same). */ for (i = same; i < num_keycodes; i++) { int key = keycode[i]; - int ch; + int ch = 0xff; /* * For a normal key (with an ASCII value), add it; otherwise @@ -492,10 +507,10 @@ static int input_keycodes_to_ascii(struct input_config *config, } if (ch_count < max_chars && ch != 0xff) output_ch[ch_count++] = (uchar)ch; - } else { + } + if (ch == 0xff) ch_count += input_keycode_to_ansi364(config, key, output_ch, max_chars); - } } if (ch_count > max_chars) {