262 Commits

Author SHA1 Message Date
Dmitry Baryshkov
b6c766db1f Merge pull request #88 from krzk/dupa
schema: Allow Fastboot serial numbers up to 16 characters
2025-07-05 16:31:36 +03:00
Krzysztof Kozlowski
031948ff19 schema: Allow Fastboot serial numbers up to 16 characters
WinLink e850 board reports Fastboot ID/serial of "00000b66ce9c23e0" and
fastboot sources [1] allow up to 256 bytes, so grow the pattern to at least
16 characters:

[1] https://android.googlesource.com/platform/system/core/+/refs/heads/android16-release/fastboot/usb.h#54

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2025-07-05 15:00:58 +02:00
Neil Armstrong
30c30ce84c Merge pull request #86 from lumag/laurent-usb
laurent: add support for controlling USB power
2025-03-18 09:32:35 +01:00
Neil Armstrong
95a40706be Merge pull request #84 from stephan-gh/ftdi-usb1
drivers: ftdi-gpio: Add second USB disconnect GPIO & schema.yaml fixes
2025-03-18 09:28:37 +01:00
Dmitry Baryshkov
4320c482d3 Merge pull request #81 from mwasilew/boot_mode
device_parser: improve error reporting
2025-02-21 19:25:36 +02:00
Dmitry Baryshkov
cdee00d9a4 Merge pull request #83 from stephan-gh/keys
cdba: Add keys to remotely press power or fastboot key
2025-02-21 19:24:42 +02:00
Dmitry Baryshkov
5bade34946 Merge pull request #85 from stephan-gh/local
cdba: Add option to run cdba-server locally without ssh and without timeout
2025-02-21 19:22:50 +02:00
Dmitry Baryshkov
3c1e7cc886 laurent: add separate USB relays support
Extend laurent driver, allowing using a relay to control USB circuits.
For example, the relay might be connected to the DIP switch on RB1 / RB2
boards.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2025-02-21 19:19:45 +02:00
Dmitry Baryshkov
bad935cbf2 device: support PPPS in parallel with the driver's USB control
Don't make PPPS path exclusive to the driver USB control. Allow both to
be used at the same time in case the setup uses both PPPS-hubs and
driver-specific control.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2025-02-21 19:17:01 +02:00
Dmitry Baryshkov
9335390898 cdba-server: don't try opening the board if there is none
If the cdba failed to find the board, don't call device_fastboot_open().

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2025-02-21 19:14:49 +02:00
Stephan Gerhold
b6d70e8b0c cdba: Add option to disable timeout_total when set to 0
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.
2025-02-14 13:58:26 +01:00
Stephan Gerhold
06531f3db1 cdba: Add option to run cdba-server locally without ssh
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.
2025-02-14 13:58:26 +01:00
Stephan Gerhold
828d76df63 cdba: Avoid hardcoding ssh binary path
Use execlp() instead of execl() to search the PATH for the ssh binary. This
avoids problems in case the ssh binary is installed in a different path.
2025-02-14 13:58:26 +01:00
Stephan Gerhold
e799564f44 cdba: Document behavior when omitting <boot.img>
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.
2025-02-14 13:58:21 +01:00
Stephan Gerhold
720922913c drivers: ftdi-gpio: Add second USB disconnect GPIO
Some boards have more than one USB port. In that case, there is a second
GPIO on the debug board to simulate a USB disconnection for those.

Add the option to describe both USB disconnect GPIOs using
"usb0_disconnect" and "usb1_disconnect" and change both of them
when disabling USB power.

In the future it might be useful to control them separately, but for now
this ensures that power to the board is cut properly when the board is
powered off.
2025-02-14 11:42:59 +01:00
Stephan Gerhold
8bd8eeda33 schema.yaml: Fix ftdi_gpio patternProperties
"patternProperties" must be on the same indentation level as "properties",
otherwise it just defines a property called "patternProperties" in
cdba.yaml.

Also add additionalProperties: false, so properties not matching the regex
are actually disallowed and reported.
2025-02-14 11:26:35 +01:00
Stephan Gerhold
f801448422 schema.yaml: Fix unevaluatedItems -> additionalProperties
unevaluatedItems is for array items, we need unevaluatedProperties here.
But actually this can just be additionalProperties.
2025-02-14 11:26:26 +01:00
Stephan Gerhold
3922dc793a cdba: Add keys to remotely press power or fastboot key
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. :-)
2025-02-14 10:35:27 +01:00
Konrad Dybcio
61babbf9ac Merge pull request #82 from lumag/fix-ci
Fix CI builds
2025-02-12 19:18:42 +01:00
Dmitry Baryshkov
358fea7207 Merge pull request #80 from quic-bjorande/for-linux-msm/dont-detect-fastboot-done-by-usb
cdba: Rely on fastboot completion rather than USB disconnect
2025-02-12 20:17:56 +02:00
Dmitry Baryshkov
b0df12edc0 status: use %lld to print time_t
Some build configurations are switching to 64-bit time_t, breaking
builds on 32-bit architectures. Always use %lld and perform an explicit
conversion to (long long int) in order to make the code compile on all
architectures.

../status.c: In function 'status_send_values':
../status.c:46:53: error: format '%ld' expects argument of type 'long int', but argument 4 has type '__time64_t' {aka 'long long int'} [-Werror=format=]

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2025-02-12 12:36:10 +02:00
Dmitry Baryshkov
59db2941f5 CI: add more Fedora releases
Add Fedora 41 and 42 to the list of build configurations.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2025-02-12 12:30:33 +02:00
Dmitry Baryshkov
8715e3b74d CI: refresh Ubuntu releases
Ubuntu Mantic has been removed from the mirros, drop it from the CI
workflow. At the same time add new Ubuntu Oracular release.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2025-02-12 12:23:04 +02:00
Milosz Wasilewski
aa0e50bb1d device_parser: improve error reporting
Add more verbose output to config file parsing errors.

Signed-off-by: Milosz Wasilewski <milosz.wasilewski@oss.qualcomm.com>
2025-02-12 10:09:18 +00:00
Bjorn Andersson
0852da5424 cdba: Rely on fastboot completion rather than USB disconnect
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>
2024-11-26 09:48:15 -08:00