If cdba is run with "-t 0", then disable the timeout completely and keep
running until manually interrupted. This is useful for non-shared boards,
e.g. when cdba is just used to power up the board remotely and you then SSH
into a standard Linux distro installed on the board.
cdba is mainly intended for remote usage, but it also works well for
controlling devices that you just need occasionally and then directly
connect to your local laptop instead of a remote server.
Another use case is if you just use cdba to power up a standard distro on a
remote board and then SSH into it remotely. To avoid interruptions, it's
better to start cdba locally on the server in a tmux session. That way,
temporary disconnections do not power down the board.
From a protocol perspective, everything is transferred through STDIN and
STDOUT. It makes no difference if we have ssh piping the data to a remote
server, or if the data is directly passed to the cdba-server binary started
locally. The functionality works exactly the same.
Add an option for this in the cdba client. If the -h <host> option is
omitted, cdba-server is started locally.
The <boot.img> option is optional in cdba. If omitted, cdba falls back to
falls back to running "fastboot continue" to boot the installed operating
system.
Add special keys to allow triggering power and fastboot key presses from
the cdba client. There is an option to send a short key "pulse" (press
followed by release after 100ms) or to press/release keys separately:
- ctrl+a -> o: Send power key pulse
- ctrl+a -> O: Toggle power key (first use: press, next use: release)
- ctrl+a -> f: Send fastboot key pulse
- ctrl+a -> F: Toggle fastboot key (first use: press, next use: release)
In most cases you want to send the "pulse" (short key press), so it's
helpful to have this mapped to a single key. This avoids forgetting to
release the key again after pressing it.
The protocol between CDBA client and server is:
(MSG_KEY_PRESS <key:u8, state:u8>)
where key is either DEVICE_KEY_FASTBOOT (0) or DEVICE_KEY_POWER (1)
and state is either KEY_PRESS_RELEASE (0), KEY_PRESS_PRESS (1) or
KEY_PRESS_PULSE (2).
The reason for implementing the "pulse" on the server side is that it's
hard to guarantee the timing on the client side. We don't know exactly when
the packets will arrive on the server. Also, "state" is a full byte anyway,
so might as well use some of the extra bits. :-)
The purpose for providing different exit codes (2 vs 110) for timeout
before or after fastboot was to allow tools invoking cdba to detect if
the device arrived at and performed fastboot or not.
In most cases relying on the fastboot (USB) disconnect notification
works fine, but in cases where the provided image fails to decompress
the standard fastboot implementation will OKAY the transfer, fail to
process the image and then return to process further fastboot requests.
This has been observed in cases where the image is too big, or when it
contains a big endian kernel.
Change the logic to rely on the "FASTBOOT_DOWNLOAD" response to
determine that we did reach fastboot and where able to upload the image
and then something happened - i.e. "there's a problem with the image" vs
"there's a setup problem".
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Replace all license headers with the SPDX-License-Identitier headers to
follow the current recommendations.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Add the ability to omit the image from the cdba call. In this case default
to "fastboot continue" on the cdba-server side.
Regular booting continues to work like this:
cdba -b db410c -h benchtop-cdba ./qlt-kernel/build/square_5.x-tracking/boot_t2a.img
New option to boot the default image a proxy for "fastboot continue"
cdba -b db410c -h benchtop-cdba
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
The updated format and behavior of the status messages is not useful for
human consumption in the console stream, but rather for programatical
consumption by 3rd party tools.
Switch the status message stream to an optional fifo, which can be
consumed separately from the console - by humans or by tools.
The fifo is created and opened and status messages requested, if the
'-s <file>' option is specified.
Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
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>