summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-cui.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-05-21 14:26:12 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-06-24 12:52:50 +0800
commit78c82fbd0a481249de1763b5d43bb9876ea612bd (patch)
tree6a18be70349e410243f9fd3fc8848da8b91165c5 /ui/ncurses/nc-cui.c
parente65870b0d7638ad9e848b87526a04e32bc96f756 (diff)
downloadtalos-petitboot-78c82fbd0a481249de1763b5d43bb9876ea612bd.tar.gz
talos-petitboot-78c82fbd0a481249de1763b5d43bb9876ea612bd.zip
ui/ncurses: Add cancel-default reporting
When we first see key input, we can tell the discover server to cancel the default boot. Untested on ps3. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui/ncurses/nc-cui.c')
-rw-r--r--ui/ncurses/nc-cui.c35
1 files changed, 4 insertions, 31 deletions
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index bd4f6b8..82e534d 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -222,7 +222,10 @@ static int cui_process_key(void *arg)
assert(cui->current);
- ui_timer_disable(&cui->timer);
+ if (!cui->has_input)
+ discover_client_cancel_default(cui->client);
+ cui->has_input = true;
+
for (;;) {
int c = getch();
@@ -258,24 +261,6 @@ static int cui_process_js(void *arg)
}
/**
- * cui_handle_timeout - Handle the timeout.
- */
-
-static void cui_handle_timeout(struct ui_timer *timer)
-{
- struct cui *cui = cui_from_timer(timer);
- struct pmenu_item *i = pmenu_find_selected(cui->main);
-
-#if defined(DEBUG)
- {
- struct cui_opt_data *cod = cod_from_item(i);
- assert(cod && (cod->opt_hash == cui->default_item));
- }
-#endif
- i->on_execute(i);
-}
-
-/**
* cui_handle_resize - Handle the term resize.
*/
@@ -399,12 +384,6 @@ static int cui_boot_option_add(struct device *dev, struct boot_option *opt,
pb_log(" initrd '%s'\n", cod->bd->initrd);
pb_log(" args '%s'\n", cod->bd->args);
- /* If this is the default_item select it and start timer. */
- if (cod->opt_hash == cui->default_item) {
- selected = i->nci;
- ui_timer_kick(&cui->timer);
- }
-
/* Re-attach the items array. */
result = set_menu_items(cui->main->ncm, cui->main->items);
@@ -459,11 +438,6 @@ static void cui_device_remove(struct device *dev, void *arg)
assert(pb_protocol_device_cmp(dev, cod->dev));
pmenu_remove(cui->main, i);
-
- /* If this is the default_item disable timer. */
-
- if (cod->opt_hash == cui->default_item)
- ui_timer_disable(&cui->timer);
}
/* Re-attach the items array. */
@@ -527,7 +501,6 @@ struct cui *cui_init(void* platform_info,
cui->c_sig = pb_cui_sig;
cui->platform_info = platform_info;
- cui->timer.handle_timeout = cui_handle_timeout;
cui->waitset = waitset_create(cui);
/* Loop here for scripts that just started the server. */
OpenPOWER on IntegriCloud