diff options
| author | Simon Glass <[email protected]> | 2025-05-02 08:46:55 -0600 |
|---|---|---|
| committer | Simon Glass <[email protected]> | 2025-05-30 09:49:33 +0100 |
| commit | 06a9d88e4d887ea4c7395636d2cfb52948ab4112 (patch) | |
| tree | 687e56b55bf793e4f5d9d2d92980f39bc51bfbca /cmd/bootflow.c | |
| parent | f8f8f822c3ea699afdf743100327c17f85d473c3 (diff) | |
expo: Update bootflow_menu_poll() to return a sequence ID
Rather than returning a bootflow, return the index of the bootflow. This
will allow callers to do their own translation to bootflows or some
other data structure.
Also return a special code when the user tries to move the pointer, so
that the caller can cancel the boot-menu timeout, if this is in use.
Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'cmd/bootflow.c')
| -rw-r--r-- | cmd/bootflow.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/cmd/bootflow.c b/cmd/bootflow.c index 55643a6876f..551dffbb8b8 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -109,18 +109,21 @@ __maybe_unused static int bootflow_handle_menu(struct bootstd_priv *std, { struct expo *exp; struct bootflow *bflow; - int ret; + int ret, seq; ret = bootflow_menu_start(std, text_mode, &exp); if (ret) return log_msg_ret("bhs", ret); + ret = -ERESTART; do { - ret = expo_render(exp); - if (ret) - return log_msg_ret("bhr", ret); - ret = bootflow_menu_poll(exp, &bflow); - } while (ret == -EAGAIN); + if (ret == -ERESTART) { + ret = expo_render(exp); + if (ret) + return log_msg_ret("bhr", ret); + } + ret = bootflow_menu_poll(exp, &seq); + } while (ret == -EAGAIN || ret == -ERESTART); if (ret == -EPIPE) { printf("Nothing chosen\n"); @@ -128,6 +131,7 @@ __maybe_unused static int bootflow_handle_menu(struct bootstd_priv *std, } else if (ret) { printf("Menu failed (err=%d)\n", ret); } else { + bflow = alist_getw(&std->bootflows, seq, struct bootflow); printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name); std->cur_bootflow = bflow; |
