diff options
author | Simon Glass <sjg@chromium.org> | 2025-05-02 08:46:40 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2025-05-30 09:49:32 +0100 |
commit | 87750b027691cd67a20ae6c5b95df65c33e8294e (patch) | |
tree | 0089c864132dd9c27a237f62470b32c0dc16e0f2 /boot/expo.c | |
parent | 589e4ccacfc6ef347a78386b8bedc666911e9c4c (diff) |
expo: Allow strings to be editable
In some cases dynamic text is needed, e.g. for a menu countdown. Add a
function which handles this, allowing the caller to take control of the
text that is shown on each render.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/expo.c')
-rw-r--r-- | boot/expo.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/boot/expo.c b/boot/expo.c index debdb60022b..4404fcb67e9 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -104,6 +104,27 @@ const char *expo_get_str(struct expo *exp, uint id) return NULL; } +int expo_edit_str(struct expo *exp, uint id, struct abuf *orig, + struct abuf **copyp) +{ + struct expo_string *estr; + struct abuf old; + + list_for_each_entry(estr, &exp->str_head, sibling) { + if (estr->id == id) { + old = estr->buf; + if (!abuf_copy(&old, &estr->buf)) + return -ENOMEM; + *copyp = &estr->buf; + if (orig) + *orig = old; + return 0; + } + } + + return -ENOENT; +} + int expo_set_display(struct expo *exp, struct udevice *dev) { struct udevice *cons; |