mirror of
https://github.com/linux-msm/cdba.git
synced 2026-02-25 13:11:56 -08:00
cdba: Add -C argument for power-cycle on success only
When using cdba to bisect for intermittent issues related to boot lockups or crashes taking us to download mode it's only useful to power-cycle on success (as a failure case shows the intermittent problem). Add a special version of the existing power cycle code, that stops the power cycling loop if a timeout criteria is hit, cutting down on unnecessary reboots of a broken kernel. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
9
cdba.c
9
cdba.c
@@ -467,6 +467,7 @@ static void usage(void)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
bool power_cycle_on_timeout = true;
|
||||
bool timeout_on_inactivity = true;
|
||||
struct termios *orig_tios;
|
||||
struct work *next;
|
||||
@@ -487,11 +488,14 @@ int main(int argc, char **argv)
|
||||
int opt;
|
||||
int ret;
|
||||
|
||||
while ((opt = getopt(argc, argv, "b:c:h:t:T:")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "b:c:C:h:t:T:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'b':
|
||||
board = optarg;
|
||||
break;
|
||||
case 'C':
|
||||
power_cycle_on_timeout = false;
|
||||
/* FALLTHROUGH */
|
||||
case 'c':
|
||||
power_cycles = atoi(optarg);
|
||||
break;
|
||||
@@ -537,6 +541,9 @@ int main(int argc, char **argv)
|
||||
if (!power_cycles)
|
||||
break;
|
||||
|
||||
if (reached_timeout && !power_cycle_on_timeout)
|
||||
break;
|
||||
|
||||
printf("power cycle (%d left)\n", power_cycles);
|
||||
fflush(stdout);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user