USB on the Primus acts up when we toggle USB in Alpaca, so add a
configuration option to force it on at all times.
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>
Make device power controller optional, allowing one to use cdba in
non-automated setup (just simplifying the fastboot + console handling).
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
[bjorn: Rebased the patch onto master, reversed the logic in power_on/off]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Instead of sleeping during the power on sequence and hence blocking e.g.
log output, use the newly introduced timers.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
In order to sleep for fractions of a second in alpaca, change the
timeout from seconds to milliseconds.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
There are cases where holding the fastboot key for too long will cause
the attached device to reset. So rather than holding the fastboot key
until fastboot arrives use the newly introduced common fastboot
handling.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
In the event that the system contains ACM devices that are not CDB
Assist these won't be either control nor target devices. So don't err
out on this.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The generic device code will now request toggling of the fastboot key
based on the device's configuration, so remove the hard coded
invocation.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Make the fastboot key handling a property of the device configuration
and use the newly introduced timeout mechanism for handling it.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
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>