X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Fncurses%2Fps3-main.c;h=1269549b7f8ac13a5dbff83b581d2d64a74f8ef2;hp=3b9fab167af22e444e4a3f67e1fc68240dbea32e;hb=4a2dbb71fdcf234302760d20333420a6e6566d56;hpb=1b0b59295d0500764c5096753f7cd11bf3ab5df4 diff --git a/ui/ncurses/ps3-main.c b/ui/ncurses/ps3-main.c index 3b9fab1..1269549 100644 --- a/ui/ncurses/ps3-main.c +++ b/ui/ncurses/ps3-main.c @@ -24,11 +24,11 @@ * ncurses mouse support */ -#if defined(HAVE_CONFIG_H) #include "config.h" -#endif #define _GNU_SOURCE + +#include #include #include #include @@ -70,7 +70,6 @@ struct opts { enum opt_value show_help; const char *log_file; enum opt_value reset_defaults; - enum opt_value use_timeout; enum opt_value show_version; }; @@ -84,11 +83,10 @@ static int opts_parse(struct opts *opts, int argc, char *argv[]) {"help", no_argument, NULL, 'h'}, {"log", required_argument, NULL, 'l'}, {"reset-defaults", no_argument, NULL, 'r'}, - {"timeout", no_argument, NULL, 't'}, {"version", no_argument, NULL, 'V'}, { NULL, 0, NULL, 0}, }; - static const char short_options[] = "hl:trV"; + static const char short_options[] = "hl:rV"; static const struct opts default_values = { .log_file = "/var/log/petitboot/petitboot-nc.log", }; @@ -109,9 +107,6 @@ static int opts_parse(struct opts *opts, int argc, char *argv[]) case 'l': opts->log_file = optarg; break; - case 't': - opts->use_timeout = opt_yes; - break; case 'r': opts->reset_defaults = opt_yes; break; @@ -280,7 +275,7 @@ static int ps3_boot_cb(struct cui *cui, struct cui_opt_data *cod) int altered_args; char *orig_args; - pb_log("%s: %s\n", __func__, cod->name); + pb_debug("%s: %s\n", __func__, cod->name); assert(ps3->cui->current == &ps3->cui->main->scr); @@ -348,7 +343,7 @@ static int ps3_svm_to_mm_cb(struct pmenu_item *item) } /** - * ps3_svm_to_mm_helper - The svm ESC callback. + * ps3_svm_to_mm_helper - The svm exit callback. */ static void ps3_svm_to_mm_helper(struct pmenu *menu) @@ -398,21 +393,6 @@ static int ps3_hot_key(struct pmenu __attribute__((unused)) *menu, return c; } -/** - * ps3_timer_update - Timer callback. - */ - -static void ps3_timer_update(struct ui_timer *timer, unsigned int timeout) -{ - struct ps3_cui *ps3 = ps3_from_cui(cui_from_timer(timer)); - - //FIXME: make scr:timer. - // nc_scr_timer_update(&ps3.mm->scr, timeout); - - nc_scr_status_printf(&ps3->mm->scr, - "Welcome to Petitboot (timeout %u sec)", timeout); -} - /** * ps3_mm_init - Setup the main menu instance. */ @@ -432,7 +412,7 @@ static struct pmenu *ps3_mm_init(struct ps3_cui *ps3_cui) } m->hot_key = ps3_hot_key; - m->on_open = cui_on_open; + m->on_new = cui_item_new; #if defined(DEBUG) m->scr.frame.title = talloc_strdup(m, @@ -441,7 +421,7 @@ static struct pmenu *ps3_mm_init(struct ps3_cui *ps3_cui) m->scr.frame.title = talloc_strdup(m, "Petitboot PS3"); #endif m->scr.frame.help = talloc_strdup(m, - "ESC=exit, Enter=accept, e=edit, o=open"); + "Enter=accept, e=edit, o=open, x=exit"); m->scr.frame.status = talloc_strdup(m, "Welcome to Petitboot"); i = pmenu_item_init(m, 0, "Boot GameOS"); @@ -492,7 +472,7 @@ static struct pmenu *ps3_svm_init(struct ps3_cui *ps3_cui) m->hot_key = ps3_hot_key; m->scr.frame.title = talloc_strdup(m, "Select PS3 Video Mode"); - m->scr.frame.help = talloc_strdup(m, "ESC=exit, Enter=accept"); + m->scr.frame.help = talloc_strdup(m, "Enter=accept, x=exit"); i = pmenu_item_init(m, 0, "auto detect"); i->on_execute = ps3_svm_cb; @@ -566,10 +546,6 @@ static void sig_handler(int signum) DBGS("%d\n", signum); switch (signum) { - case SIGALRM: - if (ps3.cui) - ui_timer_sigalrm(&ps3.cui->timer); - break; case SIGWINCH: if (ps3.cui) cui_resize(ps3.cui); @@ -666,14 +642,6 @@ int main(int argc, char *argv[]) ps3.mm = ps3_mm_init(&ps3); ps3.svm = ps3_svm_init(&ps3); - if (opts.use_timeout != opt_yes - || ps3.values.timeout == ps3_timeout_forever) - ui_timer_disable(&ps3.cui->timer); - else { - ps3.cui->timer.update_display = ps3_timer_update; - ui_timer_init(&ps3.cui->timer, ps3.values.timeout); - } - cui_result = cui_run(ps3.cui, ps3.mm, ps3.values.default_item); pmenu_delete(ps3.mm);