summaryrefslogtreecommitdiffstats
path: root/ui/ncurses
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2014-04-02 15:16:26 +0800
committerJeremy Kerr <jk@ozlabs.org>2014-04-02 15:24:15 +0800
commitbebb24a9f49cb4eb81df2aa3dd9de94db965536d (patch)
treea3b5ba8e8841a7767bd0d41586899713581e49ea /ui/ncurses
parent16ab363fe5bc4393b5dd7b9c12bbd6e5b55a22fe (diff)
downloadtalos-petitboot-bebb24a9f49cb4eb81df2aa3dd9de94db965536d.tar.gz
talos-petitboot-bebb24a9f49cb4eb81df2aa3dd9de94db965536d.zip
ui/ncurses: Add menu option to restart discovery
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui/ncurses')
-rw-r--r--ui/ncurses/generic-main.c12
-rw-r--r--ui/ncurses/nc-cui.c5
-rw-r--r--ui/ncurses/nc-cui.h1
3 files changed, 16 insertions, 2 deletions
diff --git a/ui/ncurses/generic-main.c b/ui/ncurses/generic-main.c
index 7616788..2cfb9c3 100644
--- a/ui/ncurses/generic-main.c
+++ b/ui/ncurses/generic-main.c
@@ -140,6 +140,12 @@ static int pmenu_config(struct pmenu_item *item)
return 0;
}
+static int pmenu_reinit(struct pmenu_item *item)
+{
+ cui_send_reinit(cui_from_item(item));
+ return 0;
+}
+
/**
* pb_mm_init - Setup the main menu instance.
*/
@@ -150,7 +156,7 @@ static struct pmenu *pb_mm_init(struct pb_cui *pb_cui)
struct pmenu *m;
struct pmenu_item *i;
- m = pmenu_init(pb_cui->cui, 4, cui_on_exit);
+ m = pmenu_init(pb_cui->cui, 5, cui_on_exit);
if (!m) {
pb_log("%s: failed\n", __func__);
@@ -172,7 +178,9 @@ static struct pmenu *pb_mm_init(struct pb_cui *pb_cui)
i->on_execute = pmenu_sysinfo;
i = pmenu_item_init(m, 2, "System configuration");
i->on_execute = pmenu_config;
- i = pmenu_item_init(m, 3, "Exit to shell");
+ i = pmenu_item_init(m, 3, "Rescan devices");
+ i->on_execute = pmenu_reinit;
+ i = pmenu_item_init(m, 4, "Exit to shell");
i->on_execute = pmenu_exit_cb;
result = pmenu_setup(m);
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index fd90419..88bdd0f 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -581,6 +581,11 @@ int cui_send_config(struct cui *cui, struct config *config)
return discover_client_send_config(cui->client, config);
}
+void cui_send_reinit(struct cui *cui)
+{
+ discover_client_send_reinit(cui->client);
+}
+
static struct discover_client_ops cui_client_ops = {
.device_add = NULL,
.boot_option_add = cui_boot_option_add,
diff --git a/ui/ncurses/nc-cui.h b/ui/ncurses/nc-cui.h
index e59a6b6..8632806 100644
--- a/ui/ncurses/nc-cui.h
+++ b/ui/ncurses/nc-cui.h
@@ -77,6 +77,7 @@ void cui_show_sysinfo(struct cui *cui);
void cui_show_config(struct cui *cui);
void cui_show_help(struct cui *cui, const char *title, const char *text);
int cui_send_config(struct cui *cui, struct config *config);
+void cui_send_reinit(struct cui *cui);
/* convenience routines */
OpenPOWER on IntegriCloud