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>
If conmux goes away, e.g. by someone invoking ~$quit, the read() from
the conmux fd will continously return 0, which is not discarded as an
error, but sent as a console output message to the client, continuously.
Quit bad when this happens, instead.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
When pointing alpaca to persistent named aliases in /dev/serial/by-id we
end up with > 80 chars of path in value, which gets nicely truncated.
Increase this max.
Signed-off-by: Bjorn Andersson <bjorn.andersson@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>
There are other users than myself of this, so don't hard code the conmux
id as "bjorn" but rather base it on $USER.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
There are cases where fastboot simply disconnects, where it makes sense
to maintain the cdba connection, so return gracefully from
fastboot_download() when this happens.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
When a conmux is already attached the motd becomes quite long,
surpassing the 128 bytes, bump the max response length.
This solves the problem sometimes seen as:
bad: parsing reqistry lookup response: truncated percent-encoding
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Grab a flock() in order to prohibit multiple clients from controlling
the same board at any point in time.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Use vbus to trigger boot of the devices and release the fastboot key
once we see traces of fastboot.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
For some devices it's not possible to use fastboot boot and
as such they will not enter fastboot unless the fastboot key
is held. Expose this functionality in the device api.
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>
Device attached to conmux can be controlled as well. The interface
depends on the conmux exposing the two control commands "hardreset" and
"off".
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
In order to support multiple control boards make all operations follow
indirections in the device context.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
We're not dereferencing the cdb pointer, so make it void * in order to
support alternative controllers.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Boards implementing a/b partitioning even for fastboot boot might
sometimes expire the counter and fail the boot. By always setting the
active image to 'a' we're catching this case and flipping it back, and
in other cases the operation becomes a nop.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
On Ubuntu the library link directive must come last for the libudev
references to be satisfied.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>