It's useful to be able to invoke some operation in the future, such as
releasing a key. Add support for registering and executing callbacks in
the future.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
For some devices to reliably boot into fastboot mode volume down needs
to be held, so do this as we power on the device and release it as
fastboot appears.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
If fastboot device is already present when starting cdba, cdba may miss
it. So enumerate usb devices via libudev to look for fastboot device
node.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
The error message indicating that cdba-server failed to open the config
file was supposed to be moved to cdba-server.c, but I forgot to remove
the error from the device_parser. Fix this.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
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>
After attempting to read .cdba, fall back to read /etc/cdba - to make it
possible to provide system wide configuration for a multiple users.
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>
accept() expects the passed "scalar" to be 256 bytes long, so passing
the 80 char key will cause an out-of-range write.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
It's possible for devices that are automated using e.g. a CDB Assist to
have console coming over a separate FTDI USB tty. Move the alpaca
specific implementation of the "console" directive to device.c to make
it generic.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
With tty_open() moved from cbd_assist to a common place we can use this
for the alpaca implementation as well.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The cdb_assist implementation of tty_open() can be reused by other
files, so let's move it to cdba-server.c.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
SERVER better reflects its current role and reflects the rename of the
binary from bad to cdba-server done earlier.
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
It isn't clear with CDB Assist is or that someone could even make one
with the available design files. Provide a link to the project.
Signed-off-by: Amit Kucheria <amit.kucheria@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>