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>
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>
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>