Instad of hand-coding message sending, create a single wrapper that
sends messages to the server.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Current default is to interpret 20 tilde characters as a signal to power
cycle the board and if there are no power cycles left to exit cdba.
Unfortunately gcc started spurting tilde chars in compile log, so
compiling software on the cdba target can cause cdba exit.
Change the defaults so that by default cdba doesn't interpret received
lines. One can specify '-c 0' on the cdba command line to restore
previous behaviour.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Pointer arithmetic should not be done on void pointers.
cdba.c: In function ‘fastboot_work_fn’:
cdba.c:377:38: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
377 | memcpy(msg->data, work->data + work->offset, left);
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
For debug purposes it's useful to install a user-local version of the
cdba-server and invoke this instead, rather then having to change the
code add a flag to support specifying this on the command line.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
cdba will choke with 'is not a regular file' message if one specifies
symlink as a boot file argument. Support using symlinks as a boot file.
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Add a new keyword "description" to the config file, add the necessary
wire protocol to acquire this string for a given device and introduce
the "-i" option to cdba to trigger its retrieval.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Rather than hard coding the server side path to
sandbox/cdba/cdba-server, just invoke cdba-server and rely on the server
side to have the tool in $PATH.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Add a new argument '-l' which in combination with '-h' will connect to
said server and list the attached devices, then exit.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Receiving an invalid command should lead to termination of the client,
but doing so abruptly will cause the termios not to be reset.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Exit with error code 2 if a timeout occured before fastboot had finished
executing, to allow scripts to determine if the kernel timed out or if
the board didn't finish fastboot.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Revamp the implementation of timeouts, to allow for both a total timeout
(-t) and an inactivity timeout -T at the same time. This is useful for
CI-loops where a board ending up in download mode should be
released quickly (due to inactivity), but a full test can be rather
extensive.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The current scheme of endlessly rebooting means that we spend -t amount
of time to boot the device over and over if the device crashes early.
Add a new flag -R which does this, but change the default so that if we
see the device showing up again in fastboot we consider it rebooted and
quits.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Using printf() for printing the status string often ended up in the
printf buffer and wasn't flushed out until cdba was exiting cleanly. Use
write() to get it out immediately instead.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
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>
Specifying -t means that inactivity timeout should be disabled,
regardless of the value. Specifying either -t 0 or -T 0 will set timeout
to 0, which means no timeout, regardless of timeout_on_inactivity.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reverse the logic of inactivity timeout so that by default we set
inactivity timeout to 600s. Passing -T 0 disables inactivity timeout
completely.
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
In addition to have a fixed timeout (-t) introduce a new inactivity
timeout (-T) which allow us to provide a shorter timeout to quickly
abort when the kernel fails to boot but still allow us to run lengthy
test scripts without getting a timeout.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Make the exit code non-zero when the cdba for some reason failed, to
allow tools calling cdba to differentiate the various scenarios.
There is still some tuning needed here, but for now we exit with error
code 110 if we reached a timeout, 1 if there was an error and 0 if we
either exited by user request or by hitting the power-off token.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
In the event that cdba is launched from e.g. a cron job stdin won't be a
tty and as such we can't modify the termios settings.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Support specifying a timeout -t in order to limit the execution time of
stalling test runs.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>