This makes the code more consistent with the rest of the code-base
and also allows std_gvar_min_max_step_array() to work here.
Without this change:
src/hardware/scpi-pps/api.c: In function ‘config_list’:
src/hardware/scpi-pps/api.c:570:40: warning: passing argument 1 of ‘std_gvar_min_max_step_array’ from incompatible pointer type [-Wincompatible-pointer-types]
*data = std_gvar_min_max_step_array(ch_spec->voltage);
^~~~~~~
In file included from src/scpi.h:30:0,
from src/hardware/scpi-pps/api.c:23:
src/libsigrok-internal.h:964:19: note: expected ‘const double *’ but argument is of type ‘const float *’
SR_PRIV GVariant *std_gvar_min_max_step_array(const double a[3]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/hardware/scpi-pps/api.c:573:40: warning: passing argument 1 of ‘std_gvar_min_max_step_array’ from incompatible pointer type [-Wincompatible-pointer-types]
*data = std_gvar_min_max_step_array(ch_spec->frequency);
^~~~~~~
In file included from src/scpi.h:30:0,
from src/hardware/scpi-pps/api.c:23:
src/libsigrok-internal.h:964:19: note: expected ‘const double *’ but argument is of type ‘const float *’
SR_PRIV GVariant *std_gvar_min_max_step_array(const double a[3]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/hardware/scpi-pps/api.c:576:40: warning: passing argument 1 of ‘std_gvar_min_max_step_array’ from incompatible pointer type [-Wincompatible-pointer-types]
*data = std_gvar_min_max_step_array(ch_spec->current);
^~~~~~~
In file included from src/scpi.h:30:0,
from src/hardware/scpi-pps/api.c:23:
src/libsigrok-internal.h:964:19: note: expected ‘const double *’ but argument is of type ‘const float *’
SR_PRIV GVariant *std_gvar_min_max_step_array(const double a[3]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
This ensures consistent handling of the SR_CONF_SCAN_OPTIONS and
SR_CONF_DEVICE_OPTIONS (with sdi NULL or non-NULL) config keys
and also reduces copy-pasted boilerplate in the drivers a bit.
This function does not handle channel-group specific items, that's
very driver-specific and thus left to the individual drivers.
Also move some generic checks and error messages from the drivers into
the sr_config_list() wrapper.
The HW simply stops sending data on overflows, so if we receive no data
in one second, we abort the acquisition. We also need to allocate more
buffers to support higher sample rates.
Until now, clear_helper() callbacks for std_dev_clear_with_callback()
were expected to g_free(devc), but not all of them did that.
Have std_dev_clear_with_callback() unconditionally g_free(sdi->priv)
(i.e., devc), regardless of whether a clear_helper() callback was
provided or not. It was doing g_free(sdi->priv) when no callback
was provided already anyway.
This makes the individual drivers' clear_helper() implementations
shorter and prevents errors such as missing g_free(devc) calls.
This works, because all drivers either call std_dev_clear_with_callback()
directly, or indirectly via std_dev_clear().
This also allows us to remove some no-longer needed dev_clear()
and clear_helper() implementations that only did g_free(devc)
in favor of std_dev_clear().
Be explicit and consistent in the drivers about which dev_clear function
will be called to avoid confusion and inconsistencies.
Drop some open-coded implementations of std_dev_clear().
Drop unneeded log messages, add some others that might be useful,
document which ones we're intentionally not emitting.
Don't log "$operation successful" type of messages in most cases,
that's too verbose; logging failures only is sufficient there.
baylibre-acme: Don't log "No such file or directory" messages during scan,
this triggers on all kinds of unrelated devices (e.g. "AMDGPU i2c bit
bus 0x91" in this case):
sr: [...] baylibre-acme: Name for probe 1 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0040/name”: No such file or directory
sr: [...] baylibre-acme: Name for probe 2 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0041/name”: No such file or directory
sr: [...] baylibre-acme: Name for probe 3 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0044/name”: No such file or directory
sr: [...] baylibre-acme: Name for probe 4 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0045/name”: No such file or directory
sr: [...] baylibre-acme: Name for probe 5 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0042/name”: No such file or directory
sr: [...] baylibre-acme: Name for probe 5 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-004c/name”: No such file or directory
sr: [...] baylibre-acme: Name for probe 6 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0043/name”: No such file or directory
sr: [...] baylibre-acme: Name for probe 6 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0049/name”: No such file or directory
sr: [...] baylibre-acme: Name for probe 7 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0046/name”: No such file or directory
sr: [...] baylibre-acme: Name for probe 7 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-004f/name”: No such file or directory
sr: [...] baylibre-acme: Name for probe 8 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0047/name”: No such file or directory
sr: [...] baylibre-acme: Name for probe 8 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-004b/name”: No such file or directory
- sr_dev_clear(): Don't try to clear uninitialized drivers (the same
check was previously done in std_dev_clear()).
- Document some places where we intentionally don't emit log messages.
- std: Various Doxygen fixes and updates.
- std: Add some more sanity-checks on input parameters.