From: Christian Marangi <ansuelsmth@gmail.com>
To: "Petr Štetiar" <ynezz@true.cz>
Cc: Tom Rini <trini@konsulko.com>,
Weijie Gao <weijie.gao@mediatek.com>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Daniel Golle <daniel@makrotopia.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
Simon Glass <sjg@chromium.org>,
u-boot@lists.denx.de
Subject: Re: [PATCH] cmd: bootmenu: permit to select bootmenu entry with a shortcut
Date: Sun, 25 May 2025 15:34:11 +0200 [thread overview]
Message-ID: <68331c55.df0a0220.313bd8.4d38@mx.google.com> (raw)
In-Reply-To: <aDMUzv2QIOdG+97H@meh.true.cz>
On Sun, May 25, 2025 at 01:02:13PM +0000, Petr Štetiar wrote:
> Christian Marangi <ansuelsmth@gmail.com> [2025-05-25 00:12:52]:
>
> Hi,
>
> thanks a lot for your upstreaming efforts!
>
> > Permit to select a bootmenu entry with a key shortcut. This is
> > especially useful in production or testing scenario to aitomate flashing
>
> aitomate -> automate
>
> > 0 is always reserved for Exit to console.
>
> BTW this is the only shortcut key which currently doesn't work :-) See below.
>
Eh last time bugfix and I forgot to test the 0 case... feel stupid
ahhaha
> > + case BKEY_SHORTCUT:
> > + /* invalid shortcut, regenerate menu */
> > + if (cch->shortcut_key >= menu->count - 1)
>
> IMO it should be:
>
> if (cch->shortcut_key >= menu->count)
>
> Considering menu with 4 items and user presses '0':
>
> * bootmenu_conv_shortcut_key() returns 3 (menu->count - 1), so shortcut_key = 3
>
> * With the original condition
> if (cch->shortcut_key >= menu->count - 1)
> if (3 >= 3) → true, so it returns NULL (bug)
>
> * With the fixed condition
> if (cch->shortcut_key >= menu->count):
> if (3 >= 4) → false, so it correctly proceeds
>
This is also problematic since pressing 'b' will act as exit. I have a
simple fix for this, sending v2.
> > + return NULL;
> > + menu->active = cch->shortcut_key;
> > + fallthrough;
>
> Cheers,
>
> Petr
--
Ansuel
prev parent reply other threads:[~2025-05-25 13:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-24 22:12 [PATCH] cmd: bootmenu: permit to select bootmenu entry with a shortcut Christian Marangi
2025-05-25 13:02 ` Petr Štetiar
2025-05-25 13:34 ` Christian Marangi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=68331c55.df0a0220.313bd8.4d38@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=daniel@makrotopia.org \
--cc=ilias.apalodimas@linaro.org \
--cc=marek.vasut+renesas@mailbox.org \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=weijie.gao@mediatek.com \
--cc=xypron.glpk@gmx.de \
--cc=ynezz@true.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox