cmd: bootmenu: permit to select bootmenu entry with a shortcut
Permit to select a bootmenu entry with a key shortcut. This is
especially useful in production or testing scenario to automate flashing
procedure or testing procedure.
The boot entry are changed to append the shortcut key to it.
Example:
1. Run default boot command.
2. Boot system via TFTP.
3. Boot production system from NAND.
4. Boot recovery system from NAND.
5. Load production system via TFTP then write to NAND.
6. Load recovery system via TFTP then write to NAND.
7. Load BL31+U-Boot FIP via TFTP then write to NAND.
8. Load BL2 preloader via TFTP then write to NAND.
9. Reboot.
a. Reset all settings to factory defaults.
0. Exit
0 is always reserved for Exit to console.
On pressing the keyboard key 2, the bootmenu entry 2 is selected and
executed.
Up to 34 key shortcut (0 excluded as reserved) are supported from 1-9
and a-z.
If a shortcut key not present in the bootmenu list is pressed, it is
simply ignored and eventually the autoboot is interrupted.
Capital A-Z are converted to lower a-z and the related option is
selected.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Tested-by: Petr Štetiar <ynezz@true.cz>
diff --git a/include/cli.h b/include/cli.h
index e183d56..453e88f 100644
--- a/include/cli.h
+++ b/include/cli.h
@@ -17,12 +17,14 @@
* @esc_save: Escape characters collected so far
* @emit_upto: Next index to emit from esc_save
* @emitting: true if emitting from esc_save
+ * @shortcut_key: Selected shortcut option index
*/
struct cli_ch_state {
int esc_len;
char esc_save[8];
int emit_upto;
bool emitting;
+ int shortcut_key;
};
/**
diff --git a/include/menu.h b/include/menu.h
index 6cede89..54ff3b2 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -54,6 +54,9 @@
BKEY_QUIT,
BKEY_SAVE,
+ /* shortcut key to select menu option directly */
+ BKEY_SHORTCUT,
+
/* 'extra' keys, which are used by menus but not cedit */
BKEY_PLUS,
BKEY_MINUS,