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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 614EFC433F5 for ; Tue, 26 Oct 2021 03:30:19 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8AE8A6103B for ; Tue, 26 Oct 2021 03:30:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8AE8A6103B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 58C3D8355D; Tue, 26 Oct 2021 05:30:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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; unprotected) header.d=chromium.org header.i=@chromium.org header.b="TXBA6FjW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 80DA783461; Tue, 26 Oct 2021 05:29:46 +0200 (CEST) Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CB9D78332B for ; Tue, 26 Oct 2021 05:29:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-ua1-x931.google.com with SMTP id x3so7145543uar.13 for ; Mon, 25 Oct 2021 20:29:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WWKs4p0Q81zvR7RzR8vAzU3au6AyG3e3VPLHpZfKZiI=; b=TXBA6FjWdu8mv02M9gK+CBty5lzd6GpELHjc4Gr9M7ywNmjAMH69OrwJDN0FaEFnm0 sHzdwqy4mDId7vAnQkmHSV26eUNC7bS6cOI8zDHo9KYjOx+uquetuMOF1BRht84Ul1xw OqZKbBlfcBDOPYqxdZhSqKluCROYVbAy+QIK4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WWKs4p0Q81zvR7RzR8vAzU3au6AyG3e3VPLHpZfKZiI=; b=ncR9uY1AVOCbkqANVMRCjjkj4mFIgzqYB+V1VwVJU2OOKuNPETAEWKm9uIMXmNJwmO EmZB4aSP1vzIIB/KowekecPhJ32MNsaIKlZgmS0KtzZ/cbNDtI2XwsMlWGvl6f+OWesj BvJVfOEdKO88Bms9X27qzDhUDjkf4dXX1XXEEut6OVcRF+yFpz4HDx+e0kJn2ZayRtCQ ry/EHPjL5RVYDrUFWnEJmwuuJk5g0QDOvswahQ2KvN9UDYXwaA9WAGgtzzoISDPzWC9L j3BJWE2NgrOokiZPovmYAGfH7T/H2Nm8TDs0eyFVuP8yf0KYG+ulvKpVCBRWjSp1KVf+ UHwQ== X-Gm-Message-State: AOAM533A7y1H487ZiSsIA49P131UMMWxY5O1/JvCdXU2joXUe1KvnqnE t3IrmAUkHBsg4f9D2MG+mzoUDHQu89gnGnYhFPbfeQ== X-Google-Smtp-Source: ABdhPJyjsadRDubpPReD/z0wygy2XP5p6hGTyEEAkq/AM2kV8vuDZhkM85IlKraERGrzWC/3uPzZDm8C+77LsdNHB/E= X-Received: by 2002:a05:6102:34e4:: with SMTP id bi4mr13844856vsb.20.1635218979442; Mon, 25 Oct 2021 20:29:39 -0700 (PDT) MIME-Version: 1.0 References: <20210925003055.759305-1-sjg@chromium.org> <20210925003055.759305-9-sjg@chromium.org> <9c2e118a-1b02-26d9-49c3-c300422d3220@gmx.de> In-Reply-To: <9c2e118a-1b02-26d9-49c3-c300422d3220@gmx.de> From: Simon Glass Date: Mon, 25 Oct 2021 21:29:28 -0600 Message-ID: Subject: Re: [PATCH v2 24/39] efi: serial: Support arrow keys To: Heinrich Schuchardt Cc: U-Boot Mailing List , Bin Meng , Christian Melki , Tom Rini , Ilias Apalodimas , Alexander Graf Content-Type: text/plain; charset="UTF-8" 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.103.2 at phobos.denx.de X-Virus-Status: Clean Hi Heinrich, On Mon, 18 Oct 2021 at 11:00, Heinrich Schuchardt wrote: > > On 9/25/21 2:30 AM, 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 = dev_get_priv(dev); > > + char conv_scan[10] = {0, 'p', 'n', 'f', 'b', 'a', 'e', 0, 8}; > > int ret, ch; > > > > ret = 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 correctly > > * in the U-Boot command line. > > */ > > - if (!ch && priv->key.scan_code == 8) > > - ch = 8; > > + if (!ch && priv->key.scan_code < sizeof(conv_scan)) > > + ch = conv_scan[priv->key.scan_code]; > > + if (ch >= 'a') > > + ch -= 'a' - 1; > > All 23 EFI Scan Codes should be supported. Can't we use something like > kbd_to_ansi364[] from drivers/input/input.c to create the appropriate > escape sequences? I think you are referring to this: Table 107. EFI Scan Codes for EFI_SIMPLE_TEXT_INPUT_PROTOCOL EFI Scan Code Description 0x00 Null scan code. 0x01 Move cursor up 1 row. 0x02 Move cursor down 1 row. 0x03 Move cursor right 1 column. 0x04 Move cursor left 1 column. 0x05 Home. 0x06 End. 0x07 Insert. 0x08 Delete. 0x09 Page Up. 0x0a Page Down. 0x0b Function 1. 0x0c Function 2. 0x0d Function 3. 0x0e Function 4. 0x0f Function 5. 0x10 Function 6. 0x11 Function 7. 0x12 Function 8. 0x13 Function 9. 0x14 Function 10. Which ones (other than what I have added) do you think U-Boot supports? I cannot find any. Regards, Simon