X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fvictor-dmm%2Fapi.c;h=53178b2a35ace216ce3cdbeab350321a1bd86f23;hb=41bad9283d5bf869cfdf3d54373bec4dc51eaf16;hp=e7fdb7850093f895904daabe347b197eac21a148;hpb=1987b8d63e748f0813dc6a4630e99686e4fe1728;p=libsigrok.git diff --git a/hardware/victor-dmm/api.c b/hardware/victor-dmm/api.c index e7fdb785..53178b2a 100644 --- a/hardware/victor-dmm/api.c +++ b/hardware/victor-dmm/api.c @@ -37,10 +37,10 @@ static int hw_dev_close(struct sr_dev_inst *sdi); static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data); static const int hwcaps[] = { - SR_HWCAP_MULTIMETER, - SR_HWCAP_LIMIT_MSEC, - SR_HWCAP_LIMIT_SAMPLES, - SR_HWCAP_CONTINUOUS, + SR_CONF_MULTIMETER, + SR_CONF_LIMIT_MSEC, + SR_CONF_LIMIT_SAMPLES, + SR_CONF_CONTINUOUS, 0 }; @@ -244,24 +244,7 @@ static int hw_cleanup(void) return SR_OK; } -static int hw_info_get(int info_id, const void **data, - const struct sr_dev_inst *sdi) -{ - (void)sdi; - - switch (info_id) { - case SR_DI_HWCAPS: - *data = hwcaps; - break; - default: - return SR_ERR_ARG; - } - - return SR_OK; -} - -static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, - const void *value) +static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) { struct dev_context *devc; gint64 now; @@ -279,27 +262,43 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, devc = sdi->priv; ret = SR_OK; - switch (hwcap) { - case SR_HWCAP_LIMIT_MSEC: + switch (id) { + case SR_CONF_LIMIT_MSEC: devc->limit_msec = *(const int64_t *)value; now = g_get_monotonic_time() / 1000; devc->end_time = now + devc->limit_msec; sr_dbg("Setting time limit to %" PRIu64 "ms.", devc->limit_msec); break; - case SR_HWCAP_LIMIT_SAMPLES: + case SR_CONF_LIMIT_SAMPLES: devc->limit_samples = *(const uint64_t *)value; sr_dbg("Setting sample limit to %" PRIu64 ".", devc->limit_samples); break; default: - sr_err("Unknown hardware capability: %d.", hwcap); + sr_err("Unknown hardware capability: %d.", id); ret = SR_ERR_ARG; } return ret; } +static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + case SR_CONF_DEVICE_OPTIONS: + *data = hwcaps; + break; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static void receive_transfer(struct libusb_transfer *transfer) { struct dev_context *devc; @@ -466,10 +465,10 @@ SR_PRIV struct sr_dev_driver victor_dmm_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, - .info_get = hw_info_get, - .dev_config_set = hw_dev_config_set, .dev_acquisition_start = hw_dev_acquisition_start, .dev_acquisition_stop = hw_dev_acquisition_stop, .priv = NULL,