bootmenu: factor out the user input handling

This commit moves the user input handling from cmd/bootmenu.c
to common/menu.c to reuse it from other modules.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
Masahisa Kojima 2022-04-28 17:09:45 +09:00 committed by Heinrich Schuchardt
parent 6ae494831d
commit 3ae6cf5400
3 changed files with 148 additions and 141 deletions

View file

@ -35,4 +35,24 @@ int menu_default_choice(struct menu *m, void **choice);
*/
int menu_show(int bootdelay);
struct bootmenu_data {
int delay; /* delay for autoboot */
int active; /* active menu entry */
int count; /* total count of menu entries */
struct bootmenu_entry *first; /* first menu entry */
};
enum bootmenu_key {
KEY_NONE = 0,
KEY_UP,
KEY_DOWN,
KEY_SELECT,
KEY_QUIT,
};
void bootmenu_autoboot_loop(struct bootmenu_data *menu,
enum bootmenu_key *key, int *esc);
void bootmenu_loop(struct bootmenu_data *menu,
enum bootmenu_key *key, int *esc);
#endif /* __MENU_H__ */