#include <config.h>
#include "protocol.h"
-static const uint32_t drvopts[] = {
- /* Device class */
- SR_CONF_POWER_SUPPLY,
-};
-
static const uint32_t scanopts[] = {
SR_CONF_CONN,
SR_CONF_SERIALCOMM,
};
+static const uint32_t drvopts[] = {
+ /* Device class */
+ SR_CONF_POWER_SUPPLY,
+};
+
static const uint32_t devopts[] = {
/* Device class */
SR_CONF_POWER_SUPPLY,
devc = sdi->priv;
switch (key) {
+ case SR_CONF_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_MSEC:
return sr_sw_limits_config_get(&devc->limits, key, data);
case SR_CONF_VOLTAGE:
*data = g_variant_new_double(devc->voltage);
(void)cg;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
switch (key) {
double dval;
int idx;
- (void)cg;
-
- /* Always available (with or without sdi). */
- if (key == SR_CONF_SCAN_OPTIONS) {
- *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
- scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t));
- return SR_OK;
- }
-
- /* Return drvopts without sdi (and devopts with sdi, see below). */
- if (key == SR_CONF_DEVICE_OPTIONS && !sdi) {
- *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
- drvopts, ARRAY_SIZE(drvopts), sizeof(uint32_t));
- return SR_OK;
- }
-
- /* Every other key needs an sdi. */
- if (!sdi)
- return SR_ERR_ARG;
-
- devc = sdi->priv;
+ devc = (sdi) ? sdi->priv : NULL;
switch (key) {
+ case SR_CONF_SCAN_OPTIONS:
case SR_CONF_DEVICE_OPTIONS:
- *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
- devopts, ARRAY_SIZE(devopts), sizeof(uint32_t));
- break;
+ return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_VOLTAGE_TARGET:
g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY);
/* Min, max, step. */
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
sr_sw_limits_acquisition_start(&devc->limits);
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,