summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-cui.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-10-09 16:48:38 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-10-09 17:40:41 +0800
commit47bc66a0c744f68a84147b0bd616ab25a242fb70 (patch)
tree13aad60595c03209847954c0222a37db81f7a85f /ui/ncurses/nc-cui.c
parent8ec7ea724de780a6a428a8485b2760bf1d9e0a4e (diff)
downloadtalos-petitboot-47bc66a0c744f68a84147b0bd616ab25a242fb70.tar.gz
talos-petitboot-47bc66a0c744f68a84147b0bd616ab25a242fb70.zip
ui/ncurses: Display sysinfo type & identifier
Hook into the sysinfo updates to display the type & id at the top of the petitboot main menu. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui/ncurses/nc-cui.c')
-rw-r--r--ui/ncurses/nc-cui.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index 4f7b121..35c9deb 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -473,11 +473,34 @@ static void cui_update_status(struct boot_status *status, void *arg)
}
+static void cui_update_mm_title(struct cui *cui)
+{
+ struct nc_frame *frame = &cui->main->scr.frame;
+
+ talloc_free(frame->rtitle);
+
+ frame->rtitle = talloc_strdup(cui->main, cui->sysinfo->type);
+ if (cui->sysinfo->identifier)
+ frame->rtitle = talloc_asprintf_append(frame->rtitle,
+ " %s", cui->sysinfo->identifier);
+
+ if (cui->current == &cui->main->scr)
+ cui->current->post(cui->current);
+}
+
+static void cui_update_sysinfo(struct system_info *sysinfo, void *arg)
+{
+ struct cui *cui = cui_from_arg(arg);
+ cui->sysinfo = talloc_steal(cui, sysinfo);
+ cui_update_mm_title(cui);
+}
+
static struct discover_client_ops cui_client_ops = {
.device_add = NULL,
.boot_option_add = cui_boot_option_add,
.device_remove = cui_device_remove,
.update_status = cui_update_status,
+ .update_sysinfo = cui_update_sysinfo,
};
/**
OpenPOWER on IntegriCloud