Patchwork [15/31] petitboot: Add PS3 timeout option

login
register
mail settings
Submitter Geoff Levand
Date July 8, 2009, 12:11 a.m.
Message ID <20090708001135.951141149@am.sony.com>
Download mbox | patch
Permalink /patch/29557/
State New
Headers show

Comments

Geoff Levand - July 8, 2009, 12:11 a.m.
Add an option --timeout to the PS3 CUI program to enable
the use of the autoboot timer.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
 ui/ncurses/ps3-cui.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Patch

--- 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,
 		{"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,
 		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,
 		}
 	}
 
-	return 0;
+	return optind != argc;
 }
 
 /**
@@ -551,7 +556,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;