From: Bert Vermeulen Date: Thu, 24 Jan 2013 18:19:09 +0000 (+0100) Subject: drivers: rename and reorganize config get/set X-Git-Tag: dsupstream~322 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=035a1078fda93cf1da37d19b3a1d95311b99b00f;p=libsigrok.git drivers: rename and reorganize config get/set The driver API calls info_get() and dev_config_set() have been renamed to config_get() and config_set(), respectively. --- diff --git a/backend.c b/backend.c index 9c279694..4d39502d 100644 --- a/backend.c +++ b/backend.c @@ -173,12 +173,12 @@ static int sanity_check_all_drivers(void) sr_err("No dev_close in driver %d ('%s').", i, d); errors++; } - if (!drivers[i]->info_get) { - sr_err("No info_get in driver %d ('%s').", i, d); + if (!drivers[i]->config_get) { + sr_err("No config_get in driver %d ('%s').", i, d); errors++; } - if (!drivers[i]->dev_config_set) { - sr_err("No dev_config_set in driver %d ('%s').", i, d); + if (!drivers[i]->config_set) { + sr_err("No config_set in driver %d ('%s').", i, d); errors++; } if (!drivers[i]->dev_acquisition_start) { diff --git a/device.c b/device.c index fc8477a1..a5c8c509 100644 --- a/device.c +++ b/device.c @@ -198,7 +198,7 @@ SR_API gboolean sr_dev_has_hwcap(const struct sr_dev_inst *sdi, int hwcap) if (!sdi || !sdi->driver) return FALSE; - if (sdi->driver->info_get(SR_DI_HWCAPS, + if (sdi->driver->config_get(SR_DI_HWCAPS, (const void **)&hwcaps, NULL) != SR_OK) return FALSE; @@ -334,12 +334,12 @@ SR_API int sr_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, { int ret; - if (!sdi || !sdi->driver || !sdi->driver->dev_config_set) { + if (!sdi || !sdi->driver || !sdi->driver->config_set) { sr_err("Unable to set config option."); return SR_ERR; } - ret = sdi->driver->dev_config_set(sdi, hwcap, value); + ret = sdi->driver->config_set(hwcap, value, sdi); return ret; } diff --git a/hardware/agilent-dmm/api.c b/hardware/agilent-dmm/api.c index 9d401c7e..afd26701 100644 --- a/hardware/agilent-dmm/api.c +++ b/hardware/agilent-dmm/api.c @@ -247,12 +247,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) { (void)sdi; - switch (info_id) { + switch (id) { case SR_DI_HWOPTS: *data = hwopts; break; @@ -266,8 +265,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; @@ -279,7 +277,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, return SR_ERR_BUG; } - switch (hwcap) { + switch (id) { case SR_CONF_LIMIT_MSEC: /* TODO: not yet implemented */ if (*(const uint64_t *)value == 0) { @@ -296,7 +294,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, devc->limit_samples); break; default: - sr_err("Unknown capability: %d.", hwcap); + sr_err("Unknown capability: %d.", id); return SR_ERR; break; } @@ -370,10 +368,10 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/alsa/api.c b/hardware/alsa/api.c index 22713247..4349bc81 100644 --- a/hardware/alsa/api.c +++ b/hardware/alsa/api.c @@ -140,15 +140,14 @@ 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; - if (info_id != SR_DI_HWCAPS) /* For SR_DI_HWCAPS sdi will be NULL. */ + if (id != SR_DI_HWCAPS) /* For SR_DI_HWCAPS sdi will be NULL. */ devc = sdi->priv; - switch (info_id) { + switch (id) { case SR_DI_HWCAPS: *data = hwcaps; break; @@ -169,14 +168,13 @@ 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; devc = sdi->priv; - switch (hwcap) { + switch (id) { case SR_CONF_SAMPLERATE: alsa_set_samplerate(sdi, *(const uint64_t *)value); break; @@ -184,7 +182,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, devc->limit_samples = *(const uint64_t *)value; break; default: - sr_err("Unknown capability: %d.", hwcap); + sr_err("Unknown capability: %d.", id); return SR_ERR; } @@ -322,10 +320,10 @@ SR_PRIV struct sr_dev_driver alsa_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 828121ae..3356fb23 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -787,12 +787,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; @@ -816,23 +815,22 @@ 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; int ret; devc = sdi->priv; - if (hwcap == SR_CONF_SAMPLERATE) { + if (id == SR_CONF_SAMPLERATE) { ret = set_samplerate(sdi, *(const uint64_t *)value); - } else if (hwcap == SR_CONF_LIMIT_MSEC) { + } else if (id == SR_CONF_LIMIT_MSEC) { devc->limit_msec = *(const uint64_t *)value; if (devc->limit_msec > 0) ret = SR_OK; else ret = SR_ERR; - } else if (hwcap == SR_CONF_CAPTURE_RATIO) { + } else if (id == SR_CONF_CAPTURE_RATIO) { devc->capture_ratio = *(const uint64_t *)value; if (devc->capture_ratio < 0 || devc->capture_ratio > 100) ret = SR_ERR; @@ -1438,10 +1436,10 @@ SR_PRIV struct sr_dev_driver asix_sigma_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index 08dec08e..cd6eca5f 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,7 +331,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, return SR_ERR_BUG; } - switch (hwcap) { + switch (id) { case SR_CONF_SAMPLERATE: if (set_samplerate(sdi, *(const uint64_t *)value) == SR_ERR) { sr_err("%s: setting samplerate failed.", __func__); @@ -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; } @@ -514,10 +512,10 @@ 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, .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, diff --git a/hardware/colead-slm/api.c b/hardware/colead-slm/api.c index d04ff9eb..5d350ec5 100644 --- a/hardware/colead-slm/api.c +++ b/hardware/colead-slm/api.c @@ -191,12 +191,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) { (void)sdi; - switch (info_id) { + switch (id) { case SR_DI_HWOPTS: *data = hwopts; break; @@ -210,8 +209,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; @@ -223,7 +221,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, return SR_ERR_BUG; } - switch (hwcap) { + switch (id) { case SR_CONF_LIMIT_MSEC: /* TODO: not yet implemented */ if (*(const uint64_t *)value == 0) { @@ -240,7 +238,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, devc->limit_samples); break; default: - sr_err("Unknown capability: %d.", hwcap); + sr_err("Unknown capability: %d.", id); return SR_ERR; break; } @@ -314,10 +312,10 @@ SR_PRIV struct sr_dev_driver colead_slm_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 850cf8a8..d7d0719f 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -226,12 +226,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) { (void)sdi; - switch (info_id) { + switch (id) { case SR_DI_HWCAPS: *data = hwcaps; break; @@ -251,32 +250,31 @@ 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) { int ret; const char *stropt; (void)sdi; - if (hwcap == SR_CONF_SAMPLERATE) { + if (id == SR_CONF_SAMPLERATE) { cur_samplerate = *(const uint64_t *)value; sr_dbg("%s: setting samplerate to %" PRIu64, __func__, cur_samplerate); ret = SR_OK; - } else if (hwcap == SR_CONF_LIMIT_SAMPLES) { + } else if (id == SR_CONF_LIMIT_SAMPLES) { limit_msec = 0; limit_samples = *(const uint64_t *)value; sr_dbg("%s: setting limit_samples to %" PRIu64, __func__, limit_samples); ret = SR_OK; - } else if (hwcap == SR_CONF_LIMIT_MSEC) { + } else if (id == SR_CONF_LIMIT_MSEC) { limit_msec = *(const uint64_t *)value; limit_samples = 0; sr_dbg("%s: setting limit_msec to %" PRIu64, __func__, limit_msec); ret = SR_OK; - } else if (hwcap == SR_CONF_PATTERN_MODE) { + } else if (id == SR_CONF_PATTERN_MODE) { stropt = value; ret = SR_OK; if (!strcmp(stropt, "sigrok")) { @@ -490,10 +488,10 @@ SR_PRIV struct sr_dev_driver demo_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/fluke-dmm/api.c b/hardware/fluke-dmm/api.c index adc1853c..1120bad1 100644 --- a/hardware/fluke-dmm/api.c +++ b/hardware/fluke-dmm/api.c @@ -281,12 +281,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) { (void)sdi; - switch (info_id) { + switch (id) { case SR_DI_HWOPTS: *data = hwopts; break; @@ -300,8 +299,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; @@ -313,7 +311,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, return SR_ERR_BUG; } - switch (hwcap) { + switch (id) { case SR_CONF_LIMIT_MSEC: /* TODO: not yet implemented */ if (*(const uint64_t *)value == 0) { @@ -330,7 +328,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, devc->limit_samples); break; default: - sr_err("Unknown capability: %d.", hwcap); + sr_err("Unknown capability: %d.", id); return SR_ERR; break; } @@ -410,10 +408,10 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index 43f6f525..46b65cb0 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -127,8 +127,7 @@ static const struct sr_samplerates samplerates = { SR_PRIV struct sr_dev_driver fx2lafw_driver_info; static struct sr_dev_driver *di = &fx2lafw_driver_info; static int hw_dev_close(struct sr_dev_inst *sdi); -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); static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data); /** @@ -561,8 +560,8 @@ static int hw_dev_open(struct sr_dev_inst *sdi) if (devc->cur_samplerate == 0) { /* Samplerate hasn't been set; default to the slowest one. */ - if (hw_dev_config_set(sdi, SR_CONF_SAMPLERATE, - &supported_samplerates[0]) == SR_ERR) + if (config_set(SR_CONF_SAMPLERATE, &supported_samplerates[0], + sdi) == SR_ERR) return SR_ERR; } @@ -603,12 +602,11 @@ static int hw_cleanup(void) return ret; } -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; @@ -632,18 +630,17 @@ 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; int ret; devc = sdi->priv; - if (hwcap == SR_CONF_SAMPLERATE) { + if (id == SR_CONF_SAMPLERATE) { devc->cur_samplerate = *(const uint64_t *)value; ret = SR_OK; - } else if (hwcap == SR_CONF_LIMIT_SAMPLES) { + } else if (id == SR_CONF_LIMIT_SAMPLES) { devc->limit_samples = *(const uint64_t *)value; ret = SR_OK; } else { @@ -1025,10 +1022,10 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index f25aa69f..a23161cb 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -422,14 +422,13 @@ 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) { uint64_t tmp; (void)sdi; - switch (info_id) { + switch (id) { case SR_DI_HWCAPS: *data = hwcaps; break; @@ -462,8 +461,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; struct sr_rational tmp_rat; @@ -477,7 +475,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, ret = SR_OK; devc = sdi->priv; - switch (hwcap) { + switch (id) { case SR_CONF_LIMIT_FRAMES: devc->limit_frames = *(const uint64_t *)value; break; @@ -914,10 +912,10 @@ SR_PRIV struct sr_dev_driver hantek_dso_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/lascar-el-usb/api.c b/hardware/lascar-el-usb/api.c index f0b69aee..5bc0380d 100644 --- a/hardware/lascar-el-usb/api.c +++ b/hardware/lascar-el-usb/api.c @@ -213,12 +213,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) { (void)sdi; - switch (info_id) { + switch (id) { case SR_DI_HWOPTS: *data = hwopts; break; @@ -232,8 +231,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; int ret; @@ -249,14 +247,14 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, devc = sdi->priv; ret = SR_OK; - switch (hwcap) { + switch (id) { 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; } @@ -480,10 +478,10 @@ SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/link-mso19/api.c b/hardware/link-mso19/api.c index fbd961c0..4652509a 100644 --- a/hardware/link-mso19/api.c +++ b/hardware/link-mso19/api.c @@ -298,12 +298,11 @@ static int hw_cleanup(void) return ret; } -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; @@ -327,8 +326,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) { int ret; struct dev_context *devc; @@ -341,7 +339,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, if (sdi->status != SR_ST_ACTIVE) return SR_ERR; - switch (hwcap) { + switch (id) { case SR_CONF_SAMPLERATE: // FIXME return mso_configure_rate(sdi, *(const uint64_t *)value); @@ -493,10 +491,10 @@ SR_PRIV struct sr_dev_driver link_mso19_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = hw_cleanup, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/nexus-osciprime/api.c b/hardware/nexus-osciprime/api.c index dc97b9a7..1b9cf24b 100644 --- a/hardware/nexus-osciprime/api.c +++ b/hardware/nexus-osciprime/api.c @@ -265,14 +265,13 @@ 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) { /* TODO */ (void)data; (void)sdi; - switch (info_id) { + switch (id) { default: return SR_ERR_ARG; } @@ -280,8 +279,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) { int ret; @@ -294,10 +292,10 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, } ret = SR_OK; - switch (hwcap) { + switch (id) { default: - sr_err("Unknown hardware capability: %d.", hwcap); + sr_err("Unknown hardware capability: %d.", id); ret = SR_ERR_ARG; } @@ -337,10 +335,10 @@ SR_PRIV struct sr_dev_driver nexus_osciprime_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/openbench-logic-sniffer/api.c b/hardware/openbench-logic-sniffer/api.c index b31ec5b1..dc86960b 100644 --- a/hardware/openbench-logic-sniffer/api.c +++ b/hardware/openbench-logic-sniffer/api.c @@ -250,12 +250,11 @@ static int hw_cleanup(void) return ret; } -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_HWOPTS: *data = hwopts; break; @@ -282,8 +281,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; int ret; @@ -294,7 +292,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, if (sdi->status != SR_ST_ACTIVE) return SR_ERR; - switch (hwcap) { + switch (id) { case SR_CONF_SAMPLERATE: ret = ols_set_samplerate(sdi, *(const uint64_t *)value, &samplerates); @@ -504,10 +502,10 @@ SR_PRIV struct sr_dev_driver ols_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = hw_cleanup, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/rigol-ds1xx2/api.c b/hardware/rigol-ds1xx2/api.c index 2e2ca76a..4eeacece 100644 --- a/hardware/rigol-ds1xx2/api.c +++ b/hardware/rigol-ds1xx2/api.c @@ -324,12 +324,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) { (void)sdi; - switch (info_id) { + switch (id) { case SR_DI_HWCAPS: *data = hwcaps; break; @@ -352,8 +351,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; uint64_t tmp_u64; @@ -370,7 +368,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, } ret = SR_OK; - switch (hwcap) { + switch (id) { case SR_CONF_LIMIT_FRAMES: devc->limit_frames = *(const uint64_t *)value; break; @@ -433,7 +431,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, ret = SR_ERR_ARG; break; default: - sr_err("Unknown hardware capability: %d.", hwcap); + sr_err("Unknown hardware capability: %d.", id); ret = SR_ERR_ARG; break; } @@ -509,10 +507,10 @@ SR_PRIV struct sr_dev_driver rigol_ds1xx2_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/serial-dmm/api.c b/hardware/serial-dmm/api.c index b143a358..6589d4f0 100644 --- a/hardware/serial-dmm/api.c +++ b/hardware/serial-dmm/api.c @@ -373,12 +373,11 @@ static int hw_cleanup(int dmm) 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) { (void)sdi; - switch (info_id) { + switch (id) { case SR_DI_HWOPTS: *data = hwopts; break; @@ -392,8 +391,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; @@ -405,7 +403,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, return SR_ERR_BUG; } - switch (hwcap) { + switch (id) { case SR_CONF_LIMIT_SAMPLES: devc->limit_samples = *(const uint64_t *)value; sr_dbg("Setting sample limit to %" PRIu64 ".", @@ -417,7 +415,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, devc->limit_msec); break; default: - sr_err("Unknown capability: %d.", hwcap); + sr_err("Unknown capability: %d.", id); return SR_ERR; break; } @@ -522,10 +520,10 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \ .scan = hw_scan_##ID_UPPER, \ .dev_list = hw_dev_list_##ID_UPPER, \ .dev_clear = clear_instances_##ID_UPPER, \ + .config_get = config_get, \ + .config_set = config_set, \ .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_##ID_UPPER, \ .dev_acquisition_stop = hw_dev_acquisition_stop, \ .priv = NULL, \ diff --git a/hardware/tondaj-sl-814/api.c b/hardware/tondaj-sl-814/api.c index 16099940..aded1ea8 100644 --- a/hardware/tondaj-sl-814/api.c +++ b/hardware/tondaj-sl-814/api.c @@ -195,12 +195,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) { (void)sdi; - switch (info_id) { + switch (id) { case SR_DI_HWOPTS: *data = hwopts; break; @@ -214,8 +213,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; @@ -226,14 +224,14 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, devc = sdi->priv; - switch (hwcap) { + switch (id) { 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); return SR_ERR_ARG; } @@ -307,10 +305,10 @@ SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/uni-t-dmm/api.c b/hardware/uni-t-dmm/api.c index 210703d9..cb7c6966 100644 --- a/hardware/uni-t-dmm/api.c +++ b/hardware/uni-t-dmm/api.c @@ -186,14 +186,13 @@ 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) { (void)sdi; - sr_spew("Backend requested info_id %d.", info_id); + sr_spew("Backend requested info_id %d.", id); - switch (info_id) { + switch (id) { case SR_DI_HWOPTS: *data = hwopts; break; @@ -221,14 +220,13 @@ 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; devc = sdi->priv; - switch (hwcap) { + switch (id) { case SR_CONF_LIMIT_MSEC: /* TODO: Not yet implemented. */ if (*(const uint64_t *)value == 0) { @@ -249,7 +247,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, devc->limit_samples); break; default: - sr_err("Unknown capability: %d.", hwcap); + sr_err("Unknown capability: %d.", id); return SR_ERR; break; } @@ -317,10 +315,10 @@ SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, @@ -335,10 +333,10 @@ SR_PRIV struct sr_dev_driver voltcraft_vc820_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/victor-dmm/api.c b/hardware/victor-dmm/api.c index b847fbf9..3f76a128 100644 --- a/hardware/victor-dmm/api.c +++ b/hardware/victor-dmm/api.c @@ -244,12 +244,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) { (void)sdi; - switch (info_id) { + switch (id) { case SR_DI_HWCAPS: *data = hwcaps; break; @@ -260,8 +259,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; gint64 now; @@ -279,7 +277,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, devc = sdi->priv; ret = SR_OK; - switch (hwcap) { + switch (id) { case SR_CONF_LIMIT_MSEC: devc->limit_msec = *(const int64_t *)value; now = g_get_monotonic_time() / 1000; @@ -293,7 +291,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, devc->limit_samples); break; default: - sr_err("Unknown hardware capability: %d.", hwcap); + sr_err("Unknown hardware capability: %d.", id); ret = SR_ERR_ARG; } @@ -466,10 +464,10 @@ SR_PRIV struct sr_dev_driver victor_dmm_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index fcd8c064..ba91fd5c 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -529,12 +529,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; @@ -624,8 +623,7 @@ static int set_capture_ratio(struct dev_context *devc, uint64_t ratio) 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; @@ -639,7 +637,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, return SR_ERR_ARG; } - switch (hwcap) { + switch (id) { case SR_CONF_SAMPLERATE: return set_samplerate(devc, *(const uint64_t *)value); case SR_CONF_LIMIT_SAMPLES: @@ -787,10 +785,10 @@ SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = hw_cleanup, + .config_get = config_get, + .config_set = config_set, .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, diff --git a/hwdriver.c b/hwdriver.c index 6fd91216..9bb097e8 100644 --- a/hwdriver.c +++ b/hwdriver.c @@ -324,7 +324,7 @@ SR_API int sr_info_get(struct sr_dev_driver *driver, int id, if (driver == NULL || data == NULL) return SR_ERR; - ret = driver->info_get(id, data, sdi); + ret = driver->config_get(id, data, sdi); return ret; } @@ -349,7 +349,7 @@ SR_API gboolean sr_driver_hwcap_exists(struct sr_dev_driver *driver, int hwcap) return FALSE; } - if (driver->info_get(SR_DI_HWCAPS, (const void **)&hwcaps, NULL) != SR_OK) + if (driver->config_get(SR_DI_HWCAPS, (const void **)&hwcaps, NULL) != SR_OK) return FALSE; for (i = 0; hwcaps[i]; i++) { diff --git a/libsigrok.h b/libsigrok.h index 63b2a608..90e5e537 100644 --- a/libsigrok.h +++ b/libsigrok.h @@ -595,14 +595,14 @@ struct sr_dev_driver { GSList *(*scan) (GSList *options); GSList *(*dev_list) (void); int (*dev_clear) (void); + int (*config_get) (int id, const void **value, + const struct sr_dev_inst *sdi); + int (*config_set) (int id, const void *value, + const struct sr_dev_inst *sdi); /* Device-specific */ int (*dev_open) (struct sr_dev_inst *sdi); int (*dev_close) (struct sr_dev_inst *sdi); - int (*info_get) (int info_id, const void **data, - const struct sr_dev_inst *sdi); - int (*dev_config_set) (const struct sr_dev_inst *sdi, int hwcap, - const void *value); int (*dev_acquisition_start) (const struct sr_dev_inst *sdi, void *cb_data); int (*dev_acquisition_stop) (struct sr_dev_inst *sdi, diff --git a/output/chronovu_la8.c b/output/chronovu_la8.c index e3a49145..5e5984d7 100644 --- a/output/chronovu_la8.c +++ b/output/chronovu_la8.c @@ -129,7 +129,7 @@ static int init(struct sr_output *o) ctx->unitsize = (ctx->num_enabled_probes + 7) / 8; if (sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) { - o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE, + o->sdi->driver->config_get(SR_DI_CUR_SAMPLERATE, (const void **)&samplerate, o->sdi); ctx->samplerate = *samplerate; } else diff --git a/output/csv.c b/output/csv.c index da09c3e7..a671c292 100644 --- a/output/csv.c +++ b/output/csv.c @@ -100,7 +100,7 @@ static int init(struct sr_output *o) num_probes = g_slist_length(o->sdi->probes); if (sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) { - o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE, + o->sdi->driver->config_get(SR_DI_CUR_SAMPLERATE, (const void **)&samplerate, o->sdi); ctx->samplerate = *samplerate; } else diff --git a/output/gnuplot.c b/output/gnuplot.c index 5e604230..13c7adb7 100644 --- a/output/gnuplot.c +++ b/output/gnuplot.c @@ -110,7 +110,7 @@ static int init(struct sr_output *o) num_probes = g_slist_length(o->sdi->probes); comment[0] = '\0'; if (sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) { - o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE, + o->sdi->driver->config_get(SR_DI_CUR_SAMPLERATE, (const void **)&samplerate, o->sdi); if (!(frequency_s = sr_samplerate_string(*samplerate))) { sr_err("%s: sr_samplerate_string failed", __func__); diff --git a/output/ols.c b/output/ols.c index dc5704bb..f5eaad45 100644 --- a/output/ols.c +++ b/output/ols.c @@ -70,7 +70,7 @@ static int init(struct sr_output *o) ctx->unitsize = (num_enabled_probes + 7) / 8; if (o->sdi->driver && sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) - o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE, + o->sdi->driver->config_get(SR_DI_CUR_SAMPLERATE, (const void **)&samplerate, o->sdi); else { tmp = 0; diff --git a/output/text/text.c b/output/text/text.c index e7b5d2c8..7c442ad8 100644 --- a/output/text/text.c +++ b/output/text/text.c @@ -124,7 +124,7 @@ SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode) snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING); num_probes = g_slist_length(o->sdi->probes); if (o->sdi->driver || sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) { - ret = o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE, + ret = o->sdi->driver->config_get(SR_DI_CUR_SAMPLERATE, (const void **)&samplerate, o->sdi); if (ret != SR_OK) goto err; diff --git a/output/vcd.c b/output/vcd.c index f937ef7f..39030c78 100644 --- a/output/vcd.c +++ b/output/vcd.c @@ -95,7 +95,7 @@ static int init(struct sr_output *o) PACKAGE, PACKAGE_VERSION); if (o->sdi->driver && sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) { - o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE, + o->sdi->driver->config_get(SR_DI_CUR_SAMPLERATE, (const void **)&samplerate, o->sdi); ctx->samplerate = *samplerate; if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) { diff --git a/session_driver.c b/session_driver.c index dfde8d79..52949722 100644 --- a/session_driver.c +++ b/session_driver.c @@ -148,12 +148,11 @@ static int hw_dev_open(struct sr_dev_inst *sdi) 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 session_vdev *vdev; - switch (info_id) { + switch (id) { case SR_DI_HWCAPS: *data = hwcaps; break; @@ -171,15 +170,14 @@ 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 session_vdev *vdev; const uint64_t *tmp_u64; vdev = sdi->priv; - switch (hwcap) { + switch (id) { case SR_CONF_SAMPLERATE: tmp_u64 = value; vdev->samplerate = *tmp_u64; @@ -202,7 +200,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, vdev->num_probes = *tmp_u64; break; default: - sr_err("Unknown capability: %d.", hwcap); + sr_err("Unknown capability: %d.", id); return SR_ERR; } @@ -274,10 +272,10 @@ SR_PRIV struct sr_dev_driver session_driver = { .api_version = 1, .init = hw_init, .cleanup = hw_cleanup, + .config_get = config_get, + .config_set = config_set, .dev_open = hw_dev_open, .dev_close = NULL, - .info_get = hw_info_get, - .dev_config_set = hw_dev_config_set, .dev_acquisition_start = hw_dev_acquisition_start, .dev_acquisition_stop = NULL, }; diff --git a/session_file.c b/session_file.c index c4f0db63..3168acba 100644 --- a/session_file.c +++ b/session_file.c @@ -146,18 +146,18 @@ SR_API int sr_session_load(const char *filename) /* first device, init the driver */ sdi->driver->init(NULL); sr_session_dev_add(sdi); - sdi->driver->dev_config_set(sdi, SR_CONF_SESSIONFILE, filename); - sdi->driver->dev_config_set(sdi, SR_CONF_CAPTUREFILE, val); + sdi->driver->config_set(SR_CONF_SESSIONFILE, filename, sdi); + sdi->driver->config_set(SR_CONF_CAPTUREFILE, val, sdi); g_ptr_array_add(capturefiles, val); } else if (!strcmp(keys[j], "samplerate")) { sr_parse_sizestring(val, &tmp_u64); - sdi->driver->dev_config_set(sdi, SR_CONF_SAMPLERATE, &tmp_u64); + sdi->driver->config_set(SR_CONF_SAMPLERATE, &tmp_u64, sdi); } else if (!strcmp(keys[j], "unitsize")) { tmp_u64 = strtoull(val, NULL, 10); - sdi->driver->dev_config_set(sdi, SR_CONF_CAPTURE_UNITSIZE, &tmp_u64); + sdi->driver->config_set(SR_CONF_CAPTURE_UNITSIZE, &tmp_u64, sdi); } else if (!strcmp(keys[j], "total probes")) { total_probes = strtoull(val, NULL, 10); - sdi->driver->dev_config_set(sdi, SR_CONF_CAPTURE_NUM_PROBES, &total_probes); + sdi->driver->config_set(SR_CONF_CAPTURE_NUM_PROBES, &total_probes, sdi); for (p = 0; p < total_probes; p++) { snprintf(probename, SR_MAX_PROBENAME_LEN, "%" PRIu64, p); if (!(probe = sr_probe_new(p, SR_PROBE_LOGIC, TRUE, diff --git a/strutil.c b/strutil.c index 5ac9b719..a073a758 100644 --- a/strutil.c +++ b/strutil.c @@ -230,7 +230,7 @@ SR_API char **sr_parse_triggerstring(const struct sr_dev_inst *sdi, return NULL; } - if (sdi->driver->info_get(SR_DI_TRIGGER_TYPES, + if (sdi->driver->config_get(SR_DI_TRIGGER_TYPES, (const void **)&trigger_types, sdi) != SR_OK) { sr_err("%s: Device doesn't support any triggers.", __func__); return NULL;