]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
expo: Add CLI context to the expo
authorSimon Glass <sjg@chromium.org>
Fri, 2 May 2025 14:46:15 +0000 (08:46 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 30 May 2025 08:49:31 +0000 (09:49 +0100)
An expo generally needs to keep track of the keyboard state while it is
running, so move the context into struct expo

Signed-off-by: Simon Glass <sjg@chromium.org>
boot/bootflow_menu.c
boot/cedit.c
boot/expo.c
include/expo.h

index 9d0dc352f97e5feb543fda93ac20b04c57b1e55f..43125e15832e6bb91c833bcad262acf978c06969 100644 (file)
@@ -178,7 +178,6 @@ int bootflow_menu_apply_theme(struct expo *exp, ofnode node)
 int bootflow_menu_run(struct bootstd_priv *std, bool text_mode,
                      struct bootflow **bflowp)
 {
-       struct cli_ch_state s_cch, *cch = &s_cch;
        struct bootflow *sel_bflow;
        struct udevice *dev;
        struct expo *exp;
@@ -186,8 +185,6 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode,
        bool done;
        int ret;
 
-       cli_ch_init(cch);
-
        sel_bflow = NULL;
        *bflowp = NULL;
 
@@ -225,16 +222,16 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode,
                if (ret)
                        break;
 
-               ichar = cli_ch_process(cch, 0);
+               ichar = cli_ch_process(&exp->cch, 0);
                if (!ichar) {
                        while (!ichar && !tstc()) {
                                schedule();
                                mdelay(2);
-                               ichar = cli_ch_process(cch, -ETIMEDOUT);
+                               ichar = cli_ch_process(&exp->cch, -ETIMEDOUT);
                        }
                        if (!ichar) {
                                ichar = getchar();
-                               ichar = cli_ch_process(cch, ichar);
+                               ichar = cli_ch_process(&exp->cch, ichar);
                        }
                }
 
index 4e80875828b915eb6aa1ecf2a2a444982545096c..ed499f11140c351e076fcfdea3f7f3997bc89479 100644 (file)
@@ -151,14 +151,12 @@ int cedit_prepare(struct expo *exp, struct video_priv **vid_privp,
 
 int cedit_run(struct expo *exp)
 {
-       struct cli_ch_state s_cch, *cch = &s_cch;
        struct video_priv *vid_priv;
        uint scene_id;
        struct scene *scn;
        bool done, save;
        int ret;
 
-       cli_ch_init(cch);
        ret = cedit_prepare(exp, &vid_priv, &scn);
        if (ret < 0)
                return log_msg_ret("prep", ret);
@@ -174,16 +172,16 @@ int cedit_run(struct expo *exp)
                if (ret)
                        break;
 
-               ichar = cli_ch_process(cch, 0);
+               ichar = cli_ch_process(&exp->cch, 0);
                if (!ichar) {
                        while (!ichar && !tstc()) {
                                schedule();
                                mdelay(2);
-                               ichar = cli_ch_process(cch, -ETIMEDOUT);
+                               ichar = cli_ch_process(&exp->cch, -ETIMEDOUT);
                        }
                        if (!ichar) {
                                ichar = getchar();
-                               ichar = cli_ch_process(cch, ichar);
+                               ichar = cli_ch_process(&exp->cch, ichar);
                        }
                }
 
index 8ce645e5a8f36b4ac01a9422b21d19315f6e0386..9c042f16fe7799a8237513e83104455ecbef6b6c 100644 (file)
@@ -30,6 +30,7 @@ int expo_new(const char *name, void *priv, struct expo **expp)
        INIT_LIST_HEAD(&exp->scene_head);
        INIT_LIST_HEAD(&exp->str_head);
        exp->next_id = EXPOID_BASE_ID;
+       cli_ch_init(&exp->cch);
 
        *expp = exp;
 
index 3c383d2e2ee03cc4f3edbc2d08e7b351233862e4..b3b9c0b8872309366a42e849ecc1b6df7fd0f2d4 100644 (file)
@@ -108,6 +108,7 @@ struct expo_theme {
  * @theme: Information about fonts styles, etc.
  * @scene_head: List of scenes
  * @str_head: list of strings
+ * @cch: Keyboard context for input
  */
 struct expo {
        char *name;
@@ -122,6 +123,7 @@ struct expo {
        struct expo_theme theme;
        struct list_head scene_head;
        struct list_head str_head;
+       struct cli_ch_state cch;
 };
 
 /**