Commit Graph

74 Commits

Author SHA1 Message Date
Bjorn Andersson
decff00617 cdba-server: Change watch timers to ms
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>
2020-10-29 23:44:18 -05:00
Bjorn Andersson
0fabe029ba alpaca: Use the new fastboot_key handling
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>
2020-10-29 18:24:32 -05:00
Bjorn Andersson
b0172bae3a cdb_assist: Allow non-cdb-assist ACM devices in the system
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>
2020-10-29 18:21:58 -05:00
Bjorn Andersson
ed11fe16ff cdb_assist: Rely on the generic fastboot key handling
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>
2020-10-29 18:20:39 -05:00
Bjorn Andersson
7dbd49c4d2 device: Add fastboot_key_timeout
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>
2020-10-29 18:18:56 -05:00
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