Commit Graph

202 Commits

Author SHA1 Message Date
Dmitry Baryshkov
d35abc800d cdba-server: add CDBA-server banner to be output on startup
Granted all possible issues with SSH, especially in the remote and/or
proxied labs, and possible issues with the board being present but
failing to power up, it is useful to have a banner message once CDBA was
started. This gives user a clear picture that the connection is fine and
the server is trying to power up the board.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-11-29 15:23:46 +02:00
Dmitry Baryshkov
5edc55cff8 Merge pull request #52 from lumag/syslog
Syslog sypport
2023-11-29 15:22:45 +02:00
Dmitry Baryshkov
43ed93357d cdba-server: add syslog support
Log messages to the syslog when the user opens a board.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-11-29 15:22:26 +02:00
Dmitry Baryshkov
b32d98f7a4 cdba-server: provide fallbacks for the username value
We use the CDBA_USER value as a way to pass info from cdba-shell to
cdba-server. However if it is not provide (e.g. because the cdba-server
is started directly by shell) add a fallback to the system's USER
variable. And if that's also not set, provide a safe default of
'nobody'.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-11-29 15:22:26 +02:00
Dmitry Baryshkov
3269b8b891 Merge pull request #51 from CodeLinaro/for-linux-msm/status-support
Programmatic access to remote power measurements
2023-11-28 05:34:11 +02:00
Bjorn Andersson
0ad34da4f2 samples: Provide sample with status-cmd
Provide a sample defining the status-cmd property.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
2023-11-27 21:33:35 -06:00
Bjorn Andersson
6d8ff75e31 README: Introduce status messages and fifo
Introduce description of the status fifo, the status command, and the
data format for these in the README.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
2023-11-27 21:19:58 -06:00
Bjorn Andersson
cc91b34f3a device: Disable USB on boot
Leaving USB connected might cause hickups on the USB bus, and causes
power measurements to report incorrect data. Turn it off once the image
has been downloaded.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
2023-11-27 21:19:57 -06:00
Bjorn Andersson
81e46878ed cdba-server: Allow external status command
While the CDB Assist and QcomLT Debugboard is measuring voltage and
current on the DC jack directly in the backend, other backends and
further measurements can be performed using custom tooling.

Introduce support for invoking an external "status-cmd" to produce such
status updates.

The status command should on its stdout produce json-formatted status
updates following the same format as the cdba-server:

  {"ts":%d.%03d, "name": {["mv"|"ma"]: %u}(, "name2": {["mv"|"ma"]: %u})*}

with the ts aquired using clock_gettime(CLOCK_MONOTONIC) and provided in
seconds and milliseconds since the first measurement.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
2023-11-27 21:19:57 -06:00
Bjorn Andersson
c8e29e3400 qcomlt_dbg: Enable power status reporting
The QcomLT DebugBoard has a voltage and current sensor on the 12V DC
line, which the firmware will measure upon request.

Add a periodic request for this information, parse out the responses and
report using the status helper functions.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
2023-11-27 21:19:56 -06:00
Bjorn Andersson
130720a6df cdba: Introduce status pipe
The updated format and behavior of the status messages is not useful for
human consumption in the console stream, but rather for programatical
consumption by 3rd party tools.

Switch the status message stream to an optional fifo, which can be
consumed separately from the console - by humans or by tools.

The fifo is created and opened and status messages requested, if the
'-s <file>' option is specified.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
2023-11-27 21:19:55 -06:00
Bjorn Andersson
0a3d51e9c8 cdba-server: Repurpose status update request
The MSG_STATUS_UPDATE message when sent from the client to the server,
has until now indicated a request for a single status update. This was
suitable when the update was for human consumption on occasional basis.

But with the transition to producing status messages for programatical
consumption it makes more sense to just keep the stream on, without the
client having to poll the server for updates. This can in particular
keep the external "status command" mechanism simpler.

Just enabling the stream of status updates would spam the console with
status updates for those users that hasn't updated their clients, so the
client needs to opt-in to the status stream.

Repurpose the status update message (sent from the client) to indicate
that the streaming of status updates should be enabled.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
2023-11-27 21:19:54 -06:00
Bjorn Andersson
1cef583b11 cdba-server: Introduce helper for sending measurements
The current format of the cdb_assist backend status messages was never
intended to be parsed by a non-human, and the format doesn't extend well
to other backends.

Extend the format to be formatted as a json string, with a timestamp,
implemented in a separate status module.

The button status is skipped from the new status message, as it reflect
the output-values as set by cdba itself, rather than any measured state.

The timestamp is offset to the first measurement, to avoid disclosing
the uptime of the machine cdba-server is running on.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
2023-11-27 21:18:23 -06:00
Dmitry Baryshkov
bc5e25fda0 Merge pull request #37 from calebccff/werror-and-alpine
Add Alpine Linux CI and stop enabling werror for everyone
v1.0
2023-11-06 14:34:27 +02:00
Caleb Connolly
67f2d38308 ci: add alpine tests
I plan to package CDBA in alpine, as it uses musl libc it is a lot
easier for things to break there. Add alpine latest edge and stable
build tests to catch these.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2023-11-06 12:24:54 +00:00
Caleb Connolly
ba8fa6e300 only enable -Werror in CI
Enabling -Werror by default sucks for everyone who isn't maintaining
CDBA. By all means we should enable it in CI, but not for users and
not for folks packaging it in distros.

Remove it from the flags in meson.build, and use mesons built in option
to enable it only in CI.

See:
https://embeddedartistry.com/blog/2017/05/22/werror-is-not-your-friend/

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2023-11-06 12:24:53 +00:00
Dmitry Baryshkov
18bae8dec9 cdba: remove unnecessary initialisation
Silence Clang warning by removing unused '0' from struct initialisation.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-11-06 12:21:18 +00:00
Neil Armstrong
bd5c609ad7 Merge pull request #46 from superna9999/yaml-validate
Add yaml schema and validator
2023-11-04 13:07:32 +01:00
Dmitry Baryshkov
01ebafce2a Merge pull request #44 from superna9999/ftdi-gpio-yaml-parsing
Ftdi gpio yaml parsing
2023-11-04 12:16:13 +02:00
Dmitry Baryshkov
abcf427ab0 Merge pull request #50 from superna9999/local-gpio-yaml-fix
local_gpio: simplify yaml description
2023-11-04 12:14:12 +02:00
Neil Armstrong
a2ae5974ed ftdi_gpio: accept new yaml config
Now local_gpio has landed, also accept a more verbose
and cleaner yaml config syntax for ftdi_gpio.

For now keep support for the current configuration string.

Closes: #42

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-11-02 18:18:18 +01:00
Neil Armstrong
6d953411ee ftdi_gpio: align structs with local_gpio
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-11-02 17:22:27 +01:00
Neil Armstrong
e08d14a0df local_gpio: simplify yaml description
Instead of:
    local_gpio:
      - power:
          chip: gpiochip0
          line: 7
          active_low: true
      - fastboot_key:
          chip: gpiochip0
          line: 8
          active_low: true
      - power_key:
          chip: gpiochip0
          line: 14
          active_low: true
      - usb_disconnect:
          chip: gpiochip1
          line: 4

Accept the following:
    local_gpio:
      power:
        chip: gpiochip0
        line: 7
        active_low: true
      fastboot_key:
        chip: gpiochip0
        line: 8
        active_low: true
      power_key:
        chip: gpiochip0
        line: 14
        active_low: true
      usb_disconnect:
        chip: gpiochip1
        line: 4

It's simpler and clearer.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-11-02 17:17:26 +01:00
Neil Armstrong
049cf31307 Add samples and CI test
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-11-02 11:09:32 +01:00
Neil Armstrong
5e6a988a94 Add yaml schema and validator
Closes: #41

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-11-02 11:09:32 +01:00