From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 108C4C433EF for ; Fri, 17 Dec 2021 17:09:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 668AB830C3; Fri, 17 Dec 2021 18:09:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (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="c4UhlTXK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D34AE830C4; Fri, 17 Dec 2021 18:09:37 +0100 (CET) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (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 401C78304C for ; Fri, 17 Dec 2021 18:09:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (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=1639760970; bh=YJO+gDl97hifxJASZrp0rRXjQSI7AyqM9vj3Uyo4Rf0=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=c4UhlTXKHl+RitAJ8WR0IHgR6/7Oh0qmcU5jSVNMEAu9VuXl/mGCuxS25Fmg6EyY1 8RKg+MqhG8HpRviXlKI+RDuYhaUIu0D4KU1NnSiTAnxF6l5GLR0B6rZCmqRWbhnYVk T2pfmdvRmes6f4Cp1UWsbMMRWkC4AUAzj8sJOUkw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.35] ([88.152.144.157]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M2wGi-1muyPe2YyC-003PnC; Fri, 17 Dec 2021 18:09:30 +0100 Message-ID: Date: Fri, 17 Dec 2021 18:09:25 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v5 05/28] efi: serial: Support arrow keys Content-Language: en-US To: Simon Glass Cc: Ilias Apalodimas , Christian Melki , Bin Meng , Tom Rini , Alexander Graf , U-Boot Mailing List References: <20211204155657.2913911-1-sjg@chromium.org> <20211204155657.2913911-2-sjg@chromium.org> <28446e66-5e90-f8cc-a2a8-9de1d132bc3a@gmx.de> From: Heinrich Schuchardt In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:pa4sLKUQA1KzKosnT1pVgmXvc3ONPA4XB2OqsE13DE1Td6H4X7g mHxL5XMECoc9FU/bbyzm1L6mWvDcHKwXXqpr3EzxKTS+f641TX2xWsONX4p7/5qyIU8bMXN Tbwa3VRlyGw6uyvhUgyxAGso90aMkbmaILOXTwn3tCT9D8/9zTQ40F8KDRNI9kNlowDvXaB K7q+Dgtpw8GgY90MJRS0Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:Wb+lbp/A1m0=:DfuVlrdsMbxHkkS+jBzogS +/vIEw14NnHWxJqJTd4tlm9YDZ+AatjrveJbWe+ZZ9SspOgoZLmm3JSwHed/sZnu1FdXSNaRZ 7aM6LVAUr3EzlYPh5skH8OdXEdU894c9JwcGNkQH+LODb8ipggcUbU8eka2/I0cYN/DnmnXus 47jn+HfF6+Aiai9Jtzz4JWbh5msCY9nzaXaNv370NYt+KmqdNPnw+LhrtsgvaAxug62V3smDo br/XDUwX2KSx8xrbOaWZYR35jjmkFCMrpzS5CDeQcL2TBmUhQ7DzTcr1IyXbABkrc6sF1CDUv Nh8tUCevdE+FUJNUryP9aNTz5XXfblF7g2bfaoGcKxAnXuDErqy9Zzvjnh0AnBtQYYdkcWsd2 GvyUdZzRdCvPZVTg+cK0r8A3BD33QkyhbajaJZoYFWOyu1ZhROQYR6JWiAEXeK0lps1cPPbsq xv/wJj5l/HgPDA3pFHx6TWxZdhYrYcOO410XLlCOM10ZmZNd5Iy0sZuBBZ3at9qKMehMttOwr cPtIPlpG7KYRL5A/6WMnXe7ZkHJGOo1szvRyY3j6wyel7+OSRUodd8ZPwTQKQY1fi02/opT3e Xcyq0XhIwMNSIHYE1yHQTFRSrV2fB0StMRF8TbvmbndgrSJEIxpS9UhYRe3RKuQ0NH8SXDi7E wq4lYEP5P3GTqx1hGTEyvvb29aSDVV0owMQSu+wA0lOrMRh5twKpaye40X7LcTBKu4OyVxfV8 ai3lBhX823h//EGv7zxtnFzUX7W7xjj/bh5hAW/+EkKtx+djWsBrfk/6m2k6ueReFwu+7hP2g ftrG9aV26GlotK7OqqcjlMDBrJLpLVArVvzzWlKGE3G7gKMefvn2ai9Ti3HOTI2MkTbl5F/yS 3SN/zOCrF36VAtlVkj77B6jIaeZcjtbmhyluEoredl8pTXq3RLEjreESez2xLt60oeNI1kxDg ynWPQ/yMA93qH/kvBwYp7xnZbUYzVtYyyr+QkDrnBZqnW3N4XHwXKLPJBVW5SG5oy/jQetxu0 eeK3O4t5ukUTWGvOJ7QNWofp9y5AjrXbBPownPCPKPi1t0CtsrcS19G+wXIMHwaf5cZdjcoUq j9FE3/03tlJNnc= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.103.2 at phobos.denx.de X-Virus-Status: Clean On 12/17/21 17:37, Simon Glass wrote: > Hi Heinrich, > > On Thu, 9 Dec 2021 at 12:44, Heinrich Schuchardt wr= ote: >> >> On 12/4/21 07:56, Simon Glass wrote: >>> At present only the backspace key is supported in U-Boot, when running= as >>> an EFI app. Add support for arrows, home and end as well, to make the = CLI >>> more friendly. >>> >>> Signed-off-by: Simon Glass >>> --- >>> >>> (no changes since v1) >>> >>> drivers/serial/serial_efi.c | 11 +++++++++-- >>> 1 file changed, 9 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/serial/serial_efi.c b/drivers/serial/serial_efi.c >>> index 33ddbd6080c..0067576389d 100644 >>> --- a/drivers/serial/serial_efi.c >>> +++ b/drivers/serial/serial_efi.c >>> @@ -24,6 +24,9 @@ struct serial_efi_priv { >>> bool have_key; >>> }; >>> >>> +/* Convert a lower-case character to its ctrl-char equivalent */ >>> +#define CTL_CH(c) ((c) - 'a' + 1) >>> + >>> int serial_efi_setbrg(struct udevice *dev, int baudrate) >>> { >>> return 0; >>> @@ -49,6 +52,7 @@ static int serial_efi_get_key(struct serial_efi_priv= *priv) >>> static int serial_efi_getc(struct udevice *dev) >>> { >>> struct serial_efi_priv *priv =3D dev_get_priv(dev); >>> + char conv_scan[10] =3D {0, 'p', 'n', 'f', 'b', 'a', 'e', 0, 8}; >>> int ret, ch; >>> >>> ret =3D serial_efi_get_key(priv); >>> @@ -63,8 +67,11 @@ static int serial_efi_getc(struct udevice *dev) >>> * key scan code of 8. Handle this so that backspace works corr= ectly >>> * in the U-Boot command line. >>> */ >>> - if (!ch && priv->key.scan_code =3D=3D 8) >>> - ch =3D 8; >>> + if (!ch && priv->key.scan_code < sizeof(conv_scan)) { >>> + ch =3D conv_scan[priv->key.scan_code]; >>> + if (ch >=3D 'a') >>> + ch -=3D 'a' - 1; >> >> This is not what a serial console would use in Linux. Just try U-Boot's >> conitrace command. If you use the following, we get compatibility with >> the rest of U-Boot: >> >> 1b 5b 32 7e - insert >> 1b 5b 33 7e - delete >> 1b 5b 35 7e - page up >> 1b 5b 36 7e - page down >> 1b 5b 41 - up >> 1b 5b 42 - down >> 1b 5b 43 - right >> 1b 5b 44 - left >> 1b 5b 46 - end >> 1b 5b 48 - home > > That's more complicated since it requires the serial driver to convert > one character into multiple. We can always add it later if needed. But > this does command-line history, etc. working in the app. Yes you will need a ring buffer as in the USB keyboard driver. lib/efi_loader/efi_console.c only understands the multi-byte sequences. I do not know if there are other places which have the same limitation. Best regards Heinrich > > Regards, > Simon