summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2024-10-14 16:31:57 -0600
committerSimon Glass <[email protected]>2024-10-18 14:10:22 -0600
commitd8ff97ce91529263c9d82a4bc00e133822673ab0 (patch)
tree71fabfa0482695b180c160aab18e3f0f38550d21 /boot
parent89f4f33c447e4c17e43372e3e91525187c43f54e (diff)
expo: Use standard numbering for save and discard
Set aside some expo IDs for 'save' and 'discard' buttons. This avoids needing to store the IDs for these. Adjust the documentation and expo tool for the new EXPOID_BASE_ID value. Ignore these objects when saving and loading the cedit, since they do not contain real data. Adjust 'cedit run' to return failure when the user exits the expo without saving. Update the test for this change as well. Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'boot')
-rw-r--r--boot/cedit.c24
-rw-r--r--boot/expo.c2
2 files changed, 22 insertions, 4 deletions
diff --git a/boot/cedit.c b/boot/cedit.c
index 5758cc5a0d6..cd935d4beba 100644
--- a/boot/cedit.c
+++ b/boot/cedit.c
@@ -154,7 +154,7 @@ int cedit_run(struct expo *exp)
struct video_priv *vid_priv;
uint scene_id;
struct scene *scn;
- bool done;
+ bool done, save;
int ret;
cli_ch_init(cch);
@@ -164,6 +164,7 @@ int cedit_run(struct expo *exp)
scene_id = ret;
done = false;
+ save = false;
do {
struct expo_action act;
int ichar, key;
@@ -208,6 +209,15 @@ int cedit_run(struct expo *exp)
case EXPOACT_OPEN:
scene_set_open(scn, act.select.id, true);
cedit_arange(exp, vid_priv, scene_id);
+ switch (scn->highlight_id) {
+ case EXPOID_SAVE:
+ done = true;
+ save = true;
+ break;
+ case EXPOID_DISCARD:
+ done = true;
+ break;
+ }
break;
case EXPOACT_CLOSE:
scene_set_open(scn, act.select.id, false);
@@ -229,6 +239,8 @@ int cedit_run(struct expo *exp)
if (ret)
return log_msg_ret("end", ret);
+ if (!save)
+ return -EACCES;
return 0;
}
@@ -477,6 +489,9 @@ static int h_write_settings_env(struct scene_obj *obj, void *vpriv)
const char *str;
int val, ret;
+ if (obj->id < EXPOID_BASE_ID)
+ return 0;
+
snprintf(var, sizeof(var), "c.%s", obj->name);
switch (obj->type) {
@@ -549,6 +564,9 @@ static int h_read_settings_env(struct scene_obj *obj, void *vpriv)
char var[60];
int val;
+ if (obj->id < EXPOID_BASE_ID)
+ return 0;
+
snprintf(var, sizeof(var), "c.%s", obj->name);
switch (obj->type) {
@@ -644,7 +662,7 @@ static int h_write_settings_cmos(struct scene_obj *obj, void *vpriv)
int val, ret;
uint i, seq;
- if (obj->type != SCENEOBJT_MENU)
+ if (obj->type != SCENEOBJT_MENU || obj->id < EXPOID_BASE_ID)
return 0;
menu = (struct scene_obj_menu *)obj;
@@ -734,7 +752,7 @@ static int h_read_settings_cmos(struct scene_obj *obj, void *vpriv)
int val, ret;
uint i;
- if (obj->type != SCENEOBJT_MENU)
+ if (obj->type != SCENEOBJT_MENU || obj->id < EXPOID_BASE_ID)
return 0;
menu = (struct scene_obj_menu *)obj;
diff --git a/boot/expo.c b/boot/expo.c
index 700786ec0cc..786f665f53c 100644
--- a/boot/expo.c
+++ b/boot/expo.c
@@ -29,7 +29,7 @@ int expo_new(const char *name, void *priv, struct expo **expp)
exp->priv = priv;
INIT_LIST_HEAD(&exp->scene_head);
INIT_LIST_HEAD(&exp->str_head);
- exp->next_id = 1;
+ exp->next_id = EXPOID_BASE_ID;
*expp = exp;