From: Simon Glass <sjg@chromium.org>
In some cases it is useful to provide a settings scene, or perhaps just
a button to change the layout. Add support for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
boot/bootflow_internal.h | 2 ++
boot/bootflow_menu.c | 2 ++
boot/cedit.c | 1 +
boot/scene_menu.c | 3 +++
include/bootflow.h | 3 ++-
include/expo.h | 2 ++
6 files changed, 12 insertions(+), 1 deletion(-)
@@ -13,6 +13,7 @@
* enum boomenu_id_t - expo IDs for elements of the bootflow menu
*
* @OBJ_OTHER_LOGO: Second logo (separate from the U-Boot logo)
+ * @OBJ_SETTINGS: Select settings / change layout
*
* The ranges below are as follows:
*
@@ -47,6 +48,7 @@ enum boomenu_id_t {
OBJ_POINTER,
OBJ_AUTOBOOT,
OBJ_OTHER_LOGO,
+ OBJ_SETTINGS,
/* strings for menu items */
STR_LABEL = 100,
@@ -314,6 +314,8 @@ int bootflow_menu_poll(struct expo *exp, int *seqp)
case EXPOACT_QUIT:
return -EPIPE;
case EXPOACT_CLICK:
+ if (act.select.id == OBJ_SETTINGS)
+ return -ECOMM; /* layout change request */
default:
return -EAGAIN;
}
@@ -221,6 +221,7 @@ int cedit_do_action(struct expo *exp, struct scene *scn,
exp->done = true;
break;
case EXPOACT_CLICK:
+ case EXPOACT_SETTINGS:
/* not supported by cedit */
break;
}
@@ -485,6 +485,9 @@ int scene_menu_send_key(struct scene *scn, struct scene_obj_menu *menu, int key,
log_debug("menu quit\n");
}
break;
+ case ' ':
+ event->type = EXPOACT_SETTINGS;
+ break;
case '0'...'9':
key_item = scene_menu_find_key(scn, menu, key);
if (key_item) {
@@ -743,7 +743,8 @@ int bootflow_menu_start(struct bootstd_priv *std, bool text_mode,
* Return: 0 if a bootflow was chosen, -EAGAIN if nothing is chosen yet, -EPIPE
* if the user quit, -EREMCHG if the expo needs refreshing, -ERESTART if
* the user tried to move to a new selection but was unable (e.g. already
- * at the top and tried to move up)
+ * at the top and tried to move up), -ECOMM if the user requests settings
+ * to be opened
*/
int bootflow_menu_poll(struct expo *exp, int *seqp);
@@ -57,6 +57,7 @@ enum expo_id_t {
* the menu closed, @id indicates menu opened)
* @EXPOACT_QUIT: request to exit the menu
* @EXPOACT_CLICK: click on an object
+ * @EXPOACT_SETTINGS: select menu settings
*/
enum expoact_type {
EXPOACT_NONE,
@@ -70,6 +71,7 @@ enum expoact_type {
EXPOACT_REPOINT_OPEN,
EXPOACT_QUIT,
EXPOACT_CLICK,
+ EXPOACT_SETTINGS,
};
/**