summaryrefslogtreecommitdiff
path: root/boot/expo.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-05-02 08:46:40 -0600
committerSimon Glass <sjg@chromium.org>2025-05-30 09:49:32 +0100
commit87750b027691cd67a20ae6c5b95df65c33e8294e (patch)
tree0089c864132dd9c27a237f62470b32c0dc16e0f2 /boot/expo.c
parent589e4ccacfc6ef347a78386b8bedc666911e9c4c (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.c21
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;