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 /boot | |
| 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 'boot')
| -rw-r--r-- | boot/bootflow_menu.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c index fb90e51e920..6bca17142ad 100644 --- a/boot/bootflow_menu.c +++ b/boot/bootflow_menu.c @@ -301,34 +301,28 @@ int bootflow_menu_start(struct bootstd_priv *std, bool text_mode, return 0; } -int bootflow_menu_poll(struct expo *exp, struct bootflow **bflowp) +int bootflow_menu_poll(struct expo *exp, int *seqp) { struct bootflow *sel_bflow; struct expo_action act; - int ret; + struct scene *scn; + int item, ret; sel_bflow = NULL; - *bflowp = NULL; + + scn = expo_lookup_scene_id(exp, exp->scene_id); + + item = scene_menu_get_cur_item(scn, OBJ_MENU); + *seqp = item > 0 ? item - ITEM : -1; ret = expo_poll(exp, &act); if (ret) return log_msg_ret("bmp", ret); switch (act.type) { - case EXPOACT_SELECT: { - struct bootflow *bflow; - int i; - - for (ret = bootflow_first_glob(&bflow), i = 0; !ret && i < 36; - ret = bootflow_next_glob(&bflow), i++) { - if (i == act.select.id - ITEM) { - *bflowp = bflow; - // printf("found %p\n", bflow); - return 0; - } - } + case EXPOACT_SELECT: + *seqp = act.select.id - ITEM; break; - } case EXPOACT_POINT_ITEM: { struct scene *scn = expo_lookup_scene_id(exp, MAIN); @@ -337,13 +331,13 @@ int bootflow_menu_poll(struct expo *exp, struct bootflow **bflowp) ret = scene_menu_select_item(scn, OBJ_MENU, act.select.id); if (ret) return log_msg_ret("bmp", ret); - break; + return -ERESTART; } case EXPOACT_QUIT: return -EPIPE; default: - break; + return -EAGAIN; } - return -EAGAIN; + return 0; } |
