[PATCH] cmd: bootmenu: permit to select bootmenu entry with a shortcut
Petr Štetiar
ynezz at true.cz
Sun May 25 15:02:13 CEST 2025
Christian Marangi <ansuelsmth at 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.
> + 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
> + return NULL;
> + menu->active = cch->shortcut_key;
> + fallthrough;
Cheers,
Petr
More information about the U-Boot
mailing list