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) {
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;
{
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;
}
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;
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;
return SR_ERR_BUG;
}
- switch (hwcap) {
+ switch (id) {
case SR_CONF_LIMIT_MSEC:
/* TODO: not yet implemented */
if (*(const uint64_t *)value == 0) {
devc->limit_samples);
break;
default:
- sr_err("Unknown capability: %d.", hwcap);
+ sr_err("Unknown capability: %d.", id);
return SR_ERR;
break;
}
.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,
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;
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;
devc->limit_samples = *(const uint64_t *)value;
break;
default:
- sr_err("Unknown capability: %d.", hwcap);
+ sr_err("Unknown capability: %d.", id);
return SR_ERR;
}
.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,
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;
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;
.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,
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;
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;
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__);
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;
}
.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,
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;
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;
return SR_ERR_BUG;
}
- switch (hwcap) {
+ switch (id) {
case SR_CONF_LIMIT_MSEC:
/* TODO: not yet implemented */
if (*(const uint64_t *)value == 0) {
devc->limit_samples);
break;
default:
- sr_err("Unknown capability: %d.", hwcap);
+ sr_err("Unknown capability: %d.", id);
return SR_ERR;
break;
}
.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,
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;
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")) {
.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,
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;
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;
return SR_ERR_BUG;
}
- switch (hwcap) {
+ switch (id) {
case SR_CONF_LIMIT_MSEC:
/* TODO: not yet implemented */
if (*(const uint64_t *)value == 0) {
devc->limit_samples);
break;
default:
- sr_err("Unknown capability: %d.", hwcap);
+ sr_err("Unknown capability: %d.", id);
return SR_ERR;
break;
}
.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,
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);
/**
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;
}
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;
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 {
.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,
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;
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;
ret = SR_OK;
devc = sdi->priv;
- switch (hwcap) {
+ switch (id) {
case SR_CONF_LIMIT_FRAMES:
devc->limit_frames = *(const uint64_t *)value;
break;
.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,
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;
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;
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;
}
.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,
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;
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;
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);
.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,
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;
}
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;
}
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;
}
.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,
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;
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;
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);
.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,
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;
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;
}
ret = SR_OK;
- switch (hwcap) {
+ switch (id) {
case SR_CONF_LIMIT_FRAMES:
devc->limit_frames = *(const uint64_t *)value;
break;
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;
}
.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,
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;
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;
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 ".",
devc->limit_msec);
break;
default:
- sr_err("Unknown capability: %d.", hwcap);
+ sr_err("Unknown capability: %d.", id);
return SR_ERR;
break;
}
.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, \
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;
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_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;
}
.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,
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;
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) {
devc->limit_samples);
break;
default:
- sr_err("Unknown capability: %d.", hwcap);
+ sr_err("Unknown capability: %d.", id);
return SR_ERR;
break;
}
.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,
.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,
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;
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;
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;
devc->limit_samples);
break;
default:
- sr_err("Unknown hardware capability: %d.", hwcap);
+ sr_err("Unknown hardware capability: %d.", id);
ret = SR_ERR_ARG;
}
.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,
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;
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;
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:
.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,
if (driver == NULL || data == NULL)
return SR_ERR;
- ret = driver->info_get(id, data, sdi);
+ ret = driver->config_get(id, data, sdi);
return ret;
}
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++) {
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,
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
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
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__);
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;
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;
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)))) {
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;
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;
vdev->num_probes = *tmp_u64;
break;
default:
- sr_err("Unknown capability: %d.", hwcap);
+ sr_err("Unknown capability: %d.", id);
return SR_ERR;
}
.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,
};
/* 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,
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;