From patchwork Wed Jul 8 00:11:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 29557 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id C2EEDB709F for ; Wed, 8 Jul 2009 10:21:29 +1000 (EST) Received: by ozlabs.org (Postfix) id 002ADDE42B; Wed, 8 Jul 2009 10:20:00 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id F2B12DE415 for ; Wed, 8 Jul 2009 10:19:59 +1000 (EST) X-Original-To: cbe-oss-dev@ozlabs.org Delivered-To: cbe-oss-dev@ozlabs.org Received: from hera.kernel.org (hera.kernel.org [140.211.167.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A0BB2DDDFA; Wed, 8 Jul 2009 10:18:17 +1000 (EST) Received: from hera.kernel.org (IDENT:U2FsdGVkX18cRSOcdTnBq488MjInz0AtsrroYQw/i1A@localhost [127.0.0.1]) by hera.kernel.org (8.14.2/8.14.2) with ESMTP id n680ICZw026615 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 8 Jul 2009 00:18:12 GMT Received: (from geoff@localhost) by hera.kernel.org (8.14.2/8.13.1/Submit) id n680ICgx026614; Wed, 8 Jul 2009 00:18:12 GMT Message-Id: <20090708001135.951141149@am.sony.com> User-Agent: quilt/0.47-1 Date: Tue, 07 Jul 2009 17:11:49 -0700 From: Geoff Levand To: Jeremy Kerr In-Reply-To: <20090708001134.934244536@am.sony.com> References: <20090708001134.934244536@am.sony.com> Content-Disposition: inline; filename=ps3-timeout-opt.diff X-Virus-Scanned: ClamAV 0.93.3/9541/Tue Jul 7 17:31:53 2009 on hera.kernel.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on hera.kernel.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (hera.kernel.org [127.0.0.1]); Wed, 08 Jul 2009 00:18:12 +0000 (UTC) Cc: cbe-oss-dev@ozlabs.org Subject: [Cbe-oss-dev] [patch 15/31] petitboot: Add PS3 timeout option X-BeenThere: cbe-oss-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Discussion about Open Source Software for the Cell Broadband Engine List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Add an option --timeout to the PS3 CUI program to enable the use of the autoboot timer. Signed-off-by: Geoff Levand --- ui/ncurses/ps3-cui.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- 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;