X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fchronovu-la8%2Fapi.c;h=c1d55c5b0122887e2e22ff00d481d5350ebdc85f;hb=a1c743fc51d7b49c769fb525fe4b89985a9468c9;hp=9267ca7b7c32f0446e4019fc90bd655a5ce2009e;hpb=1987b8d63e748f0813dc6a4630e99686e4fe1728;p=libsigrok.git diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index 9267ca7b..c1d55c5b 100644 --- a/hardware/chronovu-la8/api.c +++ b/hardware/chronovu-la8/api.c @@ -288,12 +288,11 @@ 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) +static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) { struct dev_context *devc; - switch (info_id) { + switch (id) { case SR_DI_HWCAPS: *data = hwcaps; break; @@ -323,8 +322,7 @@ static int hw_info_get(int info_id, const void **data, 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; @@ -333,15 +331,15 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, return SR_ERR_BUG; } - switch (hwcap) { - case SR_HWCAP_SAMPLERATE: + switch (id) { + case SR_CONF_SAMPLERATE: if (set_samplerate(sdi, *(const uint64_t *)value) == SR_ERR) { sr_err("%s: setting samplerate failed.", __func__); return SR_ERR; } sr_dbg("SAMPLERATE = %" PRIu64, devc->cur_samplerate); break; - case SR_HWCAP_LIMIT_MSEC: + case SR_CONF_LIMIT_MSEC: if (*(const uint64_t *)value == 0) { sr_err("%s: LIMIT_MSEC can't be 0.", __func__); return SR_ERR; @@ -349,7 +347,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, devc->limit_msec = *(const uint64_t *)value; sr_dbg("LIMIT_MSEC = %" PRIu64, devc->limit_msec); break; - case SR_HWCAP_LIMIT_SAMPLES: + case SR_CONF_LIMIT_SAMPLES: if (*(const uint64_t *)value < MIN_NUM_SAMPLES) { sr_err("%s: LIMIT_SAMPLES too small.", __func__); return SR_ERR; @@ -359,7 +357,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, break; default: /* Unknown capability, return SR_ERR. */ - sr_err("%s: Unknown capability: %d.", __func__, hwcap); + sr_err("%s: Unknown capability: %d.", __func__, id); return SR_ERR; break; } @@ -367,6 +365,23 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, return SR_OK; } +static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + case SR_CONF_SAMPLERATE: + fill_supported_samplerates_if_needed(); + *data = &samplerates; + break; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int receive_data(int fd, int revents, void *cb_data) { int i, ret; @@ -514,10 +529,11 @@ SR_PRIV struct sr_dev_driver chronovu_la8_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .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,