Commit Graph

69 Commits

Author SHA1 Message Date
Bjorn Andersson
b823fa0172 cdba-server: Add support for oneshot timers
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>
2020-10-29 18:17:43 -05:00
Bjorn Andersson
0d7ff9e782 alpaca: Hold volume down during boot
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>
2020-10-19 11:59:19 -05:00
Dmitry Baryshkov
793969b11d device: split console_fd handling away
Split console_fd handling to a separate source file to simplify
device.c.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2020-09-28 10:27:18 -05:00
Dmitry Baryshkov
a2d9cb9969 fastboot: enumerate devices on start
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>
2020-09-28 10:26:18 -05:00
Amit Kucheria
0ae34b601d Add cdba-server to make clean target
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2020-08-06 07:03:16 -07:00
Bjorn Andersson
af3d516228 device_parser: Suppress error message on .cdba open failure
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>
2020-06-29 10:56:47 -07:00
Bjorn Andersson
b01431a83d cdba: Print "Waiting for ssh" only for boot
For list and info the "Waiting for ssh" message is anoying, remove it.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-06-29 01:14:02 -07:00
Bjorn Andersson
4cabc1c827 Support device "description"
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>
2020-06-29 01:02:57 -07:00
Bjorn Andersson
4fee7ed011 cdba: Remove unused struct
I forgot to remove the board_list_request struct as I rewrote the code,
drop it now.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-06-29 00:59:39 -07:00
Bjorn Andersson
507f5b8bf3 device: Support device listing of devices without name
Some devices doesn't have a configured "name", don't print "(null)" in
this case.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-06-29 00:10:27 -07:00
Bjorn Andersson
afc61c7f6a cdba: Invoke cdba-server from $PATH
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>
2020-06-29 00:07:16 -07:00
Bjorn Andersson
7589adbc45 Makefile: Add install target
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-06-29 00:07:16 -07:00
Bjorn Andersson
a2a11706df device_parser: Fall back to read /etc/cdba
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>
2020-06-29 00:07:16 -07:00
Bjorn Andersson
d094208e7c cdba: Add support for listing boards
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>
2020-06-28 23:47:56 -07:00
Bjorn Andersson
72c373451c cdba: Exit nicely on communication error
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>
2020-06-28 23:43:59 -07:00
Bjorn Andersson
e0dcdf1b53 device_parser: fix out of bounds write
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>
2020-06-28 23:24:23 -07:00
Bjorn Andersson
313780c7fd cdba-server: Make "console" handling generic
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>
2020-06-27 22:54:53 -07:00
Bjorn Andersson
7febb9c100 alpaca: Use generic tty_open()
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>
2020-06-27 22:39:34 -07:00
Bjorn Andersson
ee62217745 cdba-server: Move tty_open() to common file
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>
2020-06-27 22:35:13 -07:00
Amit Kucheria
50706c5f74 Makefile: Rename CDBA symbol to SERVER
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>
2020-06-10 10:10:23 -07:00
Amit Kucheria
5b3908e1a3 README: provide link to CDB Assist
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>
2020-06-10 10:10:23 -07:00
Amit Kucheria
c5cbe74df2 bad: Rename to cdba-server
cdba-server more accurately reflects its purpose now.

Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2020-06-10 10:10:23 -07:00
Bjorn Andersson
bf2521dcdb cdba: Distinguish between timeout before and after fastboot
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>
2020-05-20 22:42:21 -07:00
Bjorn Andersson
ca0564cdbb cdba: Revamp timeout handling to support both -t and -T
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>
2020-04-30 21:17:40 -07:00
Bjorn Andersson
6efa136d8c cdba: Don't default to fastboot endlessly
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>
2020-04-09 16:18:14 -07:00