[Concept,14/18] expo: Add a way to select settings

Message ID 20251010034255.1099728-15-sjg@u-boot.org
State New
Headers
Series expo: Extend the boot menu |

Commit Message

Simon Glass Oct. 10, 2025, 3:42 a.m. UTC
  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(-)
  

Patch

diff --git a/boot/bootflow_internal.h b/boot/bootflow_internal.h
index b488ecc6102..0ae5b330bd4 100644
--- a/boot/bootflow_internal.h
+++ b/boot/bootflow_internal.h
@@ -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,
diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c
index bbc9a189c98..1f24215f392 100644
--- a/boot/bootflow_menu.c
+++ b/boot/bootflow_menu.c
@@ -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;
 	}
diff --git a/boot/cedit.c b/boot/cedit.c
index 70a0c22fe68..c82519a0eb3 100644
--- a/boot/cedit.c
+++ b/boot/cedit.c
@@ -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;
 	}
diff --git a/boot/scene_menu.c b/boot/scene_menu.c
index d54b99979e1..f52d561094b 100644
--- a/boot/scene_menu.c
+++ b/boot/scene_menu.c
@@ -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) {
diff --git a/include/bootflow.h b/include/bootflow.h
index 351a6539978..17ecc80c2eb 100644
--- a/include/bootflow.h
+++ b/include/bootflow.h
@@ -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);
 
diff --git a/include/expo.h b/include/expo.h
index 05f61cc9bd9..aa8e41af176 100644
--- a/include/expo.h
+++ b/include/expo.h
@@ -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,
 };
 
 /**