Commit Graph

250 Commits

Author SHA1 Message Date
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
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
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
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
Konrad Dybcio
2f3e661f4d Merge pull request #77 from eberman-quic/master
ftdi_gpio: Turn on OUTPUT_ENABLE first
2024-06-18 02:47:54 +02:00
Elliot Berman
2899fbcbb1 ftdi_gpio: Turn on OUTPUT_ENABLE first
Observed instability in controlling devices when OUTPUT_ENABLE wasn't
enabled in the first step. I couldn't find any documented reason why
this is, but the documentation does say: "FtdiOutput Pin always kept at
1".

Alpaca always keeps OUTUT_ENABLE as 1, and never turns it off. The
documentation seems to imply it should always be left on. This change
updates the open sequence so that the OUTPUT_ENABLE bit is set first.

Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2024-06-05 10:36:23 -07:00
Konrad Dybcio
61139604fb Merge pull request #76 from lumag/lock-who
Fix quitting if the board is locked
2024-05-31 15:57:46 +02:00
Dmitry Baryshkov
cbad92a838 cdba-server: log message on CDBA exit
To identify closing of the session, log the message when CDBA quits.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-05-31 16:57:17 +03:00
Dmitry Baryshkov
95ff3049f8 cdba-server: include PID to the syslog message
Include PID into syslog message to simplify identifying the CDBA
sessions.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-05-31 16:57:17 +03:00
Dmitry Baryshkov
5db3df360a device: loop around flock/warn
Loop around the flock(), sleeping in the middle. This allows CDBA to
break early if user closes the terminal (by killing SSH or by Ctrl-A-Q
sequence).

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-05-31 16:57:14 +03:00
Dmitry Baryshkov
02210fe6e2 Merge pull request #75 from krzk/ci-releases
Refresh CI releases
2024-05-21 10:16:49 +02:00
Krzysztof Kozlowski
b3b50a7441 ci: update checkout to v4 (to fix warning)
Fixes Github deprecation warning:

  Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v3

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2024-05-21 09:01:41 +02:00
Krzysztof Kozlowski
c86932d361 ci: add latest Ubuntu release
It is easy to forget to roll to new Ubuntu (or Fedora) release, so
always test on the latest Ubuntu version as well.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2024-05-21 08:47:40 +02:00
Krzysztof Kozlowski
d77816052d ci: add new Fedora and Ubuntu
Refresh the list of distros used for testing: add new Fedora 40 and
Ubuntu 23.10 and 24.04, while dropping unsupported Ubuntu 23.04 (Lunar).

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2024-05-21 08:41:49 +02:00
Dmitry Baryshkov
f4e95f6f0c Merge pull request #72 from lumag/laurent
laurent: driver for KernelChip Laurent family of relays
2024-04-08 23:09:06 +03:00
Dmitry Baryshkov
8f668bde64 laurent: driver for KernelChip Laurent family of relays
Add support for the KernelChip Laurent-2 / Laurent-5 / Laurent-112 /
Laurent-128 network-controlled relay arrays.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-03-30 18:20:12 +02:00