# HG changeset patch # User Michael Spacefalcon # Date 1367649545 0 # Node ID 768a3d0129319fdf1f2b44c900cbdcae4fa592c5 # Parent ae6294b8a01553696ba1be5704863cfb34e6e24a loadtool: default exit mode setting implemented diff -r ae6294b8a015 -r 768a3d012931 loadtools/hwparam.c --- a/loadtools/hwparam.c Sat May 04 06:22:09 2013 +0000 +++ b/loadtools/hwparam.c Sat May 04 06:39:05 2013 +0000 @@ -12,6 +12,8 @@ extern char default_helpers_dir[]; +extern void set_default_exit_mode(); + char hw_init_script[128]; static void @@ -104,6 +106,7 @@ char *name; void (*func)(); } cmdtab[] = { + {"exit-mode", set_default_exit_mode}, {"init-script", handle_init_script}, {"pll-config", handle_pll_config}, {"rhea-cntl", handle_rhea_cntl}, diff -r ae6294b8a015 -r 768a3d012931 loadtools/ltexit.c --- a/loadtools/ltexit.c Sat May 04 06:22:09 2013 +0000 +++ b/loadtools/ltexit.c Sat May 04 06:39:05 2013 +0000 @@ -53,3 +53,36 @@ } tp->func(); } + +/* called from hwparam.c config file parser */ +void +set_default_exit_mode(arg, filename_for_errs, lineno_for_errs) + char *arg; + char *filename_for_errs; + int lineno_for_errs; +{ + char *cp; + struct kwtab *tp; + + while (isspace(*arg)) + arg++; + if (!*arg) { + fprintf(stderr, + "%s line %d: exit-mode setting requires an argument\n", + filename_for_errs, lineno_for_errs); + exit(1); + } + for (cp = arg; *cp && !isspace(*cp); cp++) + ; + *cp = '\0'; + for (tp = exit_modes; tp->kw; tp++) + if (!strcmp(tp->kw, arg)) + break; + if (!tp->func) { + fprintf(stderr, + "%s line %d: \"%s\" is not an understood exit mode\n", + filename_for_errs, lineno_for_errs, arg); + exit(1); + } + default_exit = tp->func; +} diff -r ae6294b8a015 -r 768a3d012931 loadtools/scripts/pirelli.config --- a/loadtools/scripts/pirelli.config Sat May 04 06:22:09 2013 +0000 +++ b/loadtools/scripts/pirelli.config Sat May 04 06:39:05 2013 +0000 @@ -5,3 +5,11 @@ # The remaining settings are carried out via loadagent commands init-script pirelli.init + +# On this phone the current best exit strategy is jump0. +# A Iota power-off, even if we implement one, won't be any different: +# having the serial connection implies a USB connection, that in turn +# implies having VBUS, and thus a Iota power-off will immediately +# result in another power-on for charger-insert. + +exit-mode jump0 diff -r ae6294b8a015 -r 768a3d012931 loadtools/sertool.c --- a/loadtools/sertool.c Sat May 04 06:22:09 2013 +0000 +++ b/loadtools/sertool.c Sat May 04 06:39:05 2013 +0000 @@ -49,3 +49,10 @@ tty_passthru(); exit(0); } + +/* called from hwparam.c config file parser */ +/* stub needed for fc-sertool to link */ +void +set_default_exit_mode() +{ +}