Deprecate SR_DI_HWCAPS.
This is replaced by SR_CONF_DEVICE_OPTIONS.
This commit is contained in:
parent
c50277a6ec
commit
9a6517d14b
2
device.c
2
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->config_get(SR_DI_HWCAPS,
|
||||
if (sdi->driver->config_list(SR_CONF_DEVICE_OPTIONS,
|
||||
(const void **)&hwcaps, NULL) != SR_OK)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -255,9 +255,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
case SR_DI_HWOPTS:
|
||||
*data = hwopts;
|
||||
break;
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
@ -308,6 +305,9 @@ 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;
|
||||
}
|
||||
|
|
|
@ -144,14 +144,9 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
if (id != SR_DI_HWCAPS) /* For SR_DI_HWCAPS sdi will be NULL. */
|
||||
devc = sdi->priv;
|
||||
|
||||
switch (id) {
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
devc = sdi->priv;
|
||||
*data = &devc->cur_samplerate;
|
||||
break;
|
||||
default:
|
||||
|
@ -189,6 +184,9 @@ 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;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (!sdi || !sdi->priv)
|
||||
return SR_ERR_ARG;
|
||||
|
|
|
@ -792,9 +792,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
struct dev_context *devc;
|
||||
|
||||
switch (id) {
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (sdi) {
|
||||
devc = sdi->priv;
|
||||
|
@ -843,6 +840,9 @@ 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;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &samplerates;
|
||||
break;
|
||||
|
|
|
@ -293,9 +293,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
struct dev_context *devc;
|
||||
|
||||
switch (id) {
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (sdi) {
|
||||
devc = sdi->priv;
|
||||
|
@ -361,6 +358,9 @@ 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;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
fill_supported_samplerates_if_needed();
|
||||
*data = &samplerates;
|
||||
|
|
|
@ -199,9 +199,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
case SR_DI_HWOPTS:
|
||||
*data = hwopts;
|
||||
break;
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
@ -252,6 +249,9 @@ 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;
|
||||
}
|
||||
|
|
|
@ -231,9 +231,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
(void)sdi;
|
||||
|
||||
switch (id) {
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &cur_samplerate;
|
||||
break;
|
||||
|
@ -298,6 +295,9 @@ 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;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &samplerates;
|
||||
break;
|
||||
|
|
|
@ -289,9 +289,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
case SR_DI_HWOPTS:
|
||||
*data = hwopts;
|
||||
break;
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
@ -342,6 +339,9 @@ 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;
|
||||
}
|
||||
|
|
|
@ -607,9 +607,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
struct dev_context *devc;
|
||||
|
||||
switch (id) {
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (sdi) {
|
||||
devc = sdi->priv;
|
||||
|
@ -650,6 +647,9 @@ 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;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &samplerates;
|
||||
break;
|
||||
|
|
|
@ -429,9 +429,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
(void)sdi;
|
||||
|
||||
switch (id) {
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
/* TODO remove this */
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &tmp;
|
||||
|
@ -568,6 +565,9 @@ 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;
|
||||
case SR_CONF_BUFFERSIZE:
|
||||
*data = buffersizes;
|
||||
break;
|
||||
|
|
|
@ -221,9 +221,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
case SR_DI_HWOPTS:
|
||||
*data = hwopts;
|
||||
break;
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
@ -267,6 +264,9 @@ 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;
|
||||
}
|
||||
|
|
|
@ -303,9 +303,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
struct dev_context *devc;
|
||||
|
||||
switch (id) {
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (sdi) {
|
||||
devc = sdi->priv;
|
||||
|
@ -392,6 +389,9 @@ 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;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &samplerates;
|
||||
break;
|
||||
|
|
|
@ -258,9 +258,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
case SR_DI_HWOPTS:
|
||||
*data = hwopts;
|
||||
break;
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (sdi) {
|
||||
devc = sdi->priv;
|
||||
|
@ -329,6 +326,9 @@ 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;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &samplerates;
|
||||
break;
|
||||
|
|
|
@ -329,9 +329,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
(void)sdi;
|
||||
|
||||
switch (id) {
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
@ -433,6 +430,9 @@ 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;
|
||||
case SR_CONF_COUPLING:
|
||||
*data = coupling;
|
||||
break;
|
||||
|
|
|
@ -381,9 +381,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
case SR_DI_HWOPTS:
|
||||
*data = hwopts;
|
||||
break;
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
@ -429,6 +426,9 @@ 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;
|
||||
}
|
||||
|
|
|
@ -203,9 +203,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
case SR_DI_HWOPTS:
|
||||
*data = hwopts;
|
||||
break;
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
@ -244,6 +241,9 @@ 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;
|
||||
}
|
||||
|
|
|
@ -196,10 +196,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
case SR_DI_HWOPTS:
|
||||
*data = hwopts;
|
||||
break;
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
sr_spew("%s: Returning hwcaps.", __func__);
|
||||
break;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
/* TODO: Get rid of this. */
|
||||
*data = NULL;
|
||||
|
@ -255,6 +251,9 @@ 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;
|
||||
}
|
||||
|
|
|
@ -249,9 +249,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
(void)sdi;
|
||||
|
||||
switch (id) {
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
@ -304,6 +301,9 @@ 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;
|
||||
}
|
||||
|
|
|
@ -534,9 +534,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
struct dev_context *devc;
|
||||
|
||||
switch (id) {
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (sdi) {
|
||||
devc = sdi->priv;
|
||||
|
@ -647,6 +644,9 @@ 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;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &samplerates;
|
||||
break;
|
||||
|
|
|
@ -365,7 +365,7 @@ SR_API gboolean sr_driver_hwcap_exists(struct sr_dev_driver *driver, int hwcap)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (driver->config_get(SR_DI_HWCAPS, (const void **)&hwcaps, NULL) != SR_OK)
|
||||
if (driver->config_list(SR_CONF_DEVICE_OPTIONS, (const void **)&hwcaps, NULL) != SR_OK)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; hwcaps[i]; i++) {
|
||||
|
|
10
libsigrok.h
10
libsigrok.h
|
@ -388,7 +388,7 @@ enum {
|
|||
/** The device can measure humidity. */
|
||||
SR_CONF_HYGROMETER,
|
||||
|
||||
/*--- Driver options ------------------------------------------------*/
|
||||
/*--- Driver scan options -------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Specification on how to connect to a device.
|
||||
|
@ -466,6 +466,12 @@ enum {
|
|||
|
||||
/*--- Special stuff -------------------------------------------------*/
|
||||
|
||||
/** Scan options supported by the driver. */
|
||||
SR_CONF_SCAN_OPTIONS,
|
||||
|
||||
/** Device options for a particular device. */
|
||||
SR_CONF_DEVICE_OPTIONS,
|
||||
|
||||
/** Session filename. */
|
||||
SR_CONF_SESSIONFILE = 40000,
|
||||
|
||||
|
@ -552,8 +558,6 @@ enum {
|
|||
enum {
|
||||
/** A list of options supported by the driver. */
|
||||
SR_DI_HWOPTS = 10000,
|
||||
/** A list of capabilities supported by the device. */
|
||||
SR_DI_HWCAPS,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -153,9 +153,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
|
|||
struct session_vdev *vdev;
|
||||
|
||||
switch (id) {
|
||||
case SR_DI_HWCAPS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (sdi) {
|
||||
vdev = sdi->priv;
|
||||
|
@ -207,6 +204,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
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_DEVICE_OPTIONS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
{
|
||||
|
@ -274,6 +287,7 @@ SR_PRIV struct sr_dev_driver session_driver = {
|
|||
.cleanup = hw_cleanup,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = NULL,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
Loading…
Reference in New Issue