X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ui%2Fncurses%2Fps3-cui.c;h=cb63849f631d2903ff2e38e0e955e060609ffe93;hb=25cb540c8b73a044911ef7dab5b57879de1779e9;hp=96a6e72090c16eb646a912a3c5dea65800c5b87e;hpb=aea1d55d7e09f4544f96ccc54196c674d52420e8;p=petitboot diff --git a/ui/ncurses/ps3-cui.c b/ui/ncurses/ps3-cui.c index 96a6e72..cb63849 100644 --- a/ui/ncurses/ps3-cui.c +++ b/ui/ncurses/ps3-cui.c @@ -53,7 +53,7 @@ static void print_usage(void) print_version(); printf( "Usage: pb-cui [-h, --help] [-l, --log log-file] [-r, --reset-defaults]\n" -" [-V, --version]\n"); +" [-t, --timeout] [-V, --version]\n"); } /** @@ -70,6 +70,7 @@ 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; }; @@ -83,10 +84,11 @@ 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:rV"; + static const char short_options[] = "hl:trV"; static const struct opts default_values = { .log_file = "pb-cui.log", }; @@ -107,6 +109,9 @@ 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; @@ -119,7 +124,7 @@ static int opts_parse(struct opts *opts, int argc, char *argv[]) } } - return 0; + return optind != argc; } /** @@ -194,11 +199,12 @@ static int ps3_kexec_cb(struct cui *cui, struct cui_opt_data *cod) { struct ps3_cui *ps3 = ps3_from_cui(cui); - pb_log("%s: %s:%s\n", __func__, cod->dev->name, cod->opt->name); + pb_log("%s: %s\n", __func__, cod->name); assert(ps3->cui->current == &ps3->cui->main->scr); - if (cui->default_item != cod->opt_hash || ps3->dirty_values) { + if ((cod->opt_hash && cod->opt_hash != cui->default_item) + || ps3->dirty_values) { ps3->values.default_item = cod->opt_hash; ps3_flash_set_values(&ps3->values); } @@ -311,8 +317,7 @@ static struct pmenu *ps3_mm_init(struct ps3_cui *ps3_cui) int result; struct pmenu *m; struct pmenu_item *i; - static const char *const bgo[] = - {"/usr/sbin/ps3-boot-game-os-NOT", NULL}; + static const char *const bgo[] = {"/usr/sbin/ps3-boot-game-os", NULL}; m = pmenu_init(ps3_cui->cui, 3, cui_on_exit); @@ -322,9 +327,16 @@ static struct pmenu *ps3_mm_init(struct ps3_cui *ps3_cui) } m->hot_key = ps3_hot_key; + m->on_open = cui_on_open; + +#if defined(DEBUG) + m->scr.frame.title = talloc_strdup(m, + "Petitboot PS3 (ver " PACKAGE_VERSION ")"); +#else m->scr.frame.title = talloc_strdup(m, "Petitboot PS3"); +#endif m->scr.frame.help = talloc_strdup(m, - "ESC=exit, Enter=accept, E,e=edit"); + "ESC=exit, Enter=accept, e=edit, o=open"); m->scr.frame.status = talloc_strdup(m, "Welcome to Petitboot"); i = pmenu_item_init(m, 0, "Boot GameOS", @@ -551,7 +563,8 @@ int main(int argc, char *argv[]) ps3.mm = ps3_mm_init(&ps3); ps3.svm = ps3_svm_init(&ps3); - if (ps3.values.timeout == ps3_timeout_forever) + 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;