Commit Graph

85 Commits

Author SHA1 Message Date
Bjorn Andersson
1abac8b200 device: Combine power_on/power_off througout
Squash the power_on and power_off into a single "power" function, to
harmonize the code wrt the USB handling.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-01-22 18:52:03 -06:00
Bjorn Andersson
4913b8b1c7 cdb_assist: Remove remnants of PSHOLD based shutdown
Some ancient device needed us to pull PSHOLD to trigger the shutdown,
but most of the code is lost, so clean out the last pieces until the
need comes up again.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-01-22 18:27:01 -06:00
Bjorn Andersson
3921fcb8a3 cdb_assist: Drop all the USB magic
All modern systems will properly populate /dev/serial/by-id with links
to the CDB Assist control and target tty, that includes the serial
number in the name.

So there's no reason to keep the complex code that scans for the two
devices by serial number around.

Switch the parameter of "cdb_assist" to be the path of the control tty
and rely on "console" for the "terminal" tty.

Naturally this breaks existing config files.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-01-22 18:13:38 -06:00
Bjorn Andersson
032a43b7ee conmux: Use "control_dev" instead of "cdb_serial"
It seems more suitable to use the "control_dev" to denote the target
conmux than "cdb_serial". Further more this makes it possible drop the
"cdb_serial" member in an upcoming commit.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-01-22 18:07:26 -06:00
Bjorn Andersson
87ad99ecf2 alpaca: Rename device member holding control device path
By renaming the "alpaca_dev" to "control_dev" is can be reused in the
other implementations as well.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-01-22 18:06:26 -06:00
Bjorn Andersson
776f8c30fb console: Add send_break support
Add support for send_break to the generic console implementation.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-01-22 18:04:58 -06:00
Bjorn Andersson
e685d367bc alpaca: Add configuration for keeping USB always connected
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>
2021-01-22 17:26:17 -06:00
Dmitry Baryshkov
dde2030cda cdba: allow specifying symlink as a boot file
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>
2021-01-21 08:56:58 -08:00
Dmitry Baryshkov
aac4562cfc README: document last changes
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2020-11-16 14:19:49 -06:00
Dmitry Baryshkov
b626f41185 device: support working in non-automated setup
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>
2020-11-16 14:19:07 -06:00
Bjorn Andersson
5eac176fb5 alpaca: Implement power on sequence using watch timers
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>
2020-10-29 23:44:25 -05:00
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