X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Fncurses%2Fps3-main.c;h=5be8c3258a9477671322f8ffcc0418a028a8d8a7;hp=26d2591d467f7112fa63b7f351dde76f8d4224ba;hb=63575c2045b1505da7a2abca8a51a4a7aa3df6f7;hpb=52b9db95764fcdee9195113d7df225634a19c9f4 diff --git a/ui/ncurses/ps3-main.c b/ui/ncurses/ps3-main.c index 26d2591..5be8c32 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; @@ -267,13 +262,13 @@ static int ps3_svm_cb(struct pmenu_item *item) } /** - * ps3_kexec_cb - The kexec callback. + * ps3_boot_cb - The kexec callback. * - * Writes config data to PS3 flash then calls pb_run_kexec(). + * Writes config data to PS3 flash then calls pb_boot(). * Adds a video mode arg to the kernel command line if needed. */ -static int ps3_kexec_cb(struct cui *cui, struct cui_opt_data *cod) +static int ps3_boot_cb(struct cui *cui, struct cui_opt_data *cod) { struct ps3_cui *ps3 = ps3_from_cui(cui); int result; @@ -294,24 +289,24 @@ static int ps3_kexec_cb(struct cui *cui, struct cui_opt_data *cod) /* Add a default kernel video mode. */ - if (!cod->kd->args) { + if (!cod->bd->args) { altered_args = 1; orig_args = NULL; - cod->kd->args = talloc_asprintf(NULL, "video=ps3fb:mode:%u", + cod->bd->args = talloc_asprintf(NULL, "video=ps3fb:mode:%u", (unsigned int)ps3->values.video_mode); - } else if (!strstr(cod->kd->args, "video=")) { + } else if (!strstr(cod->bd->args, "video=")) { altered_args = 1; - orig_args = cod->kd->args; - cod->kd->args = talloc_asprintf(NULL, "%s video=ps3fb:mode:%u", + orig_args = cod->bd->args; + cod->bd->args = talloc_asprintf(NULL, "%s video=ps3fb:mode:%u", orig_args, (unsigned int)ps3->values.video_mode); } else altered_args = 0; - result = pb_run_kexec(cod->kd, ps3->cui->dry_run); + result = pb_boot(cod->bd, ps3->cui->dry_run); if (altered_args) { - talloc_free(cod->kd->args); - cod->kd->args = orig_args; + talloc_free(cod->bd->args); + cod->bd->args = orig_args; } return result; @@ -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. */ @@ -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); @@ -658,7 +634,7 @@ int main(int argc, char *argv[]) if (!result && (ps3.values.video_mode != (uint16_t)mode)) ps3_set_video_mode(ps3.values.video_mode); - ps3.cui = cui_init(&ps3, ps3_kexec_cb, ps3_sixaxis_map); + ps3.cui = cui_init(&ps3, ps3_boot_cb, ps3_sixaxis_map); if (!ps3.cui) return EXIT_FAILURE; @@ -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);