probe_groups: API changes required to implement probe groups.
This commit is contained in:
parent
8dce54f7aa
commit
8f996b8948
3
device.c
3
device.c
|
@ -208,7 +208,8 @@ SR_API gboolean sr_dev_has_option(const struct sr_dev_inst *sdi, int key)
|
|||
if (!sdi || !sdi->driver || !sdi->driver->config_list)
|
||||
return FALSE;
|
||||
|
||||
if (sdi->driver->config_list(SR_CONF_DEVICE_OPTIONS, &gvar, NULL) != SR_OK)
|
||||
if (sdi->driver->config_list(SR_CONF_DEVICE_OPTIONS,
|
||||
&gvar, NULL, NULL) != SR_OK)
|
||||
return FALSE;
|
||||
|
||||
ret = FALSE;
|
||||
|
|
|
@ -200,10 +200,13 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -235,10 +238,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
|
|
|
@ -128,10 +128,13 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
switch (id) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
devc = sdi->priv;
|
||||
|
@ -144,10 +147,13 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -167,13 +173,16 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
GVariant *gvar;
|
||||
GVariantBuilder gvb;
|
||||
int i;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_DEVICE_OPTIONS:
|
||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||
|
|
|
@ -744,10 +744,13 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
switch (id) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (sdi) {
|
||||
|
@ -763,11 +766,14 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
int ret;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -794,12 +800,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
GVariant *gvar;
|
||||
GVariantBuilder gvb;
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_DEVICE_OPTIONS:
|
||||
|
|
|
@ -180,11 +180,14 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
int ret;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -208,9 +211,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
|
|
|
@ -262,10 +262,13 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
switch (id) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (sdi) {
|
||||
|
@ -283,10 +286,13 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -326,12 +332,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
GVariant *gvar;
|
||||
GVariantBuilder gvb;
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_DEVICE_OPTIONS:
|
||||
|
|
|
@ -147,10 +147,13 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -182,10 +185,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
|
|
|
@ -225,10 +225,13 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *const devc = sdi->priv;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
switch (id) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = g_variant_new_uint64(devc->cur_samplerate);
|
||||
|
@ -265,11 +268,13 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
int ret;
|
||||
const char *stropt;
|
||||
|
||||
(void)probe_group;
|
||||
struct dev_context *const devc = sdi->priv;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
|
@ -317,12 +322,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
GVariant *gvar;
|
||||
GVariantBuilder gvb;
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_DEVICE_OPTIONS:
|
||||
|
|
|
@ -233,10 +233,13 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -268,10 +271,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
|
|
|
@ -350,12 +350,15 @@ static int cleanup(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
struct sr_usb_dev_inst *usb;
|
||||
char str[128];
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
switch (id) {
|
||||
case SR_CONF_CONN:
|
||||
if (!sdi || !sdi->conn)
|
||||
|
@ -381,11 +384,14 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
int ret;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR;
|
||||
|
||||
|
@ -404,12 +410,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
GVariant *gvar;
|
||||
GVariantBuilder gvb;
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
|
|
|
@ -422,11 +422,14 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct sr_usb_dev_inst *usb;
|
||||
char str[128];
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
switch (id) {
|
||||
case SR_CONF_CONN:
|
||||
if (!sdi || !sdi->conn)
|
||||
|
@ -452,7 +455,8 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
double tmp_double;
|
||||
|
@ -462,6 +466,8 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
const char *tmp_str;
|
||||
char **targets;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -579,13 +585,16 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
GVariant *tuple, *rational[2];
|
||||
GVariantBuilder gvb;
|
||||
unsigned int i;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (!sdi)
|
||||
return SR_ERR_ARG;
|
||||
|
||||
|
|
|
@ -163,13 +163,16 @@ static int cleanup(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
struct sr_usb_dev_inst *usb;
|
||||
int ret;
|
||||
char str[128];
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
devc = sdi->priv;
|
||||
switch (id) {
|
||||
case SR_CONF_CONN:
|
||||
|
@ -196,11 +199,14 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
int ret;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -233,10 +239,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
|
|
|
@ -291,10 +291,13 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
switch (id) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (sdi) {
|
||||
|
@ -310,7 +313,8 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
int ret;
|
||||
struct dev_context *devc;
|
||||
|
@ -318,6 +322,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
int trigger_pos;
|
||||
double pos;
|
||||
|
||||
(void)probe_group;
|
||||
devc = sdi->priv;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
|
@ -376,11 +381,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
GVariant *gvar;
|
||||
GVariantBuilder gvb;
|
||||
|
||||
(void)probe_group;
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
|
|
|
@ -188,10 +188,13 @@ static int cleanup(int idx)
|
|||
return dev_clear(idx);
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -215,9 +218,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
|
|
|
@ -235,10 +235,13 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (!sdi)
|
||||
return SR_ERR_ARG;
|
||||
|
||||
|
@ -269,13 +272,16 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
int ret;
|
||||
uint64_t tmp_u64;
|
||||
const char *stropt;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -354,12 +360,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
GVariant *gvar;
|
||||
GVariantBuilder gvb;
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
|
|
|
@ -370,10 +370,12 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (id) {
|
||||
case SR_CONF_NUM_TIMEBASE:
|
||||
|
@ -389,7 +391,8 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
uint64_t tmp_u64, p, q;
|
||||
|
@ -398,6 +401,8 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
int ret;
|
||||
const char *tmp_str;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
devc = sdi->priv;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
|
@ -497,13 +502,16 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
GVariant *tuple, *rational[2];
|
||||
GVariantBuilder gvb;
|
||||
unsigned int i;
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||
|
|
|
@ -411,10 +411,13 @@ static int cleanup(int dmm)
|
|||
return dev_clear(dmm);
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -441,10 +444,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
|
|
|
@ -159,10 +159,13 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -181,10 +184,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
|
|
|
@ -229,10 +229,13 @@ static int cleanup(int dmm)
|
|||
return dev_clear(dmm);
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
devc = sdi->priv;
|
||||
|
||||
switch (id) {
|
||||
|
@ -261,9 +264,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
|
|
|
@ -205,11 +205,14 @@ static int cleanup(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct sr_usb_dev_inst *usb;
|
||||
char str[128];
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
switch (id) {
|
||||
case SR_CONF_CONN:
|
||||
if (!sdi || !sdi->conn)
|
||||
|
@ -225,12 +228,15 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
gint64 now;
|
||||
int ret;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -261,10 +267,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
|
|
|
@ -467,10 +467,13 @@ static int cleanup(void)
|
|||
return dev_clear();
|
||||
}
|
||||
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
switch (id) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (sdi) {
|
||||
|
@ -488,10 +491,13 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
@ -514,12 +520,15 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
GVariant *gvar;
|
||||
GVariantBuilder gvb;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_DEVICE_OPTIONS:
|
||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||
|
|
22
hwdriver.c
22
hwdriver.c
|
@ -504,8 +504,10 @@ SR_PRIV void sr_config_free(struct sr_config *src)
|
|||
* but this is not to be flagged as an error by the caller; merely
|
||||
* as an indication that it's not applicable.
|
||||
*/
|
||||
SR_API int sr_config_get(const struct sr_dev_driver *driver, int key,
|
||||
GVariant **data, const struct sr_dev_inst *sdi)
|
||||
SR_API int sr_config_get(const struct sr_dev_driver *driver,
|
||||
const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group,
|
||||
int key, GVariant **data)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -515,7 +517,7 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver, int key,
|
|||
if (!driver->config_get)
|
||||
return SR_ERR_ARG;
|
||||
|
||||
if ((ret = driver->config_get(key, data, sdi)) == SR_OK) {
|
||||
if ((ret = driver->config_get(key, data, sdi, probe_group)) == SR_OK) {
|
||||
/* Got a floating reference from the driver. Sink it here,
|
||||
* caller will need to unref when done with it. */
|
||||
g_variant_ref_sink(*data);
|
||||
|
@ -538,7 +540,9 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver, int key,
|
|||
* but this is not to be flagged as an error by the caller; merely
|
||||
* as an indication that it's not applicable.
|
||||
*/
|
||||
SR_API int sr_config_set(const struct sr_dev_inst *sdi, int key, GVariant *data)
|
||||
SR_API int sr_config_set(const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group,
|
||||
int key, GVariant *data)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -549,7 +553,7 @@ SR_API int sr_config_set(const struct sr_dev_inst *sdi, int key, GVariant *data)
|
|||
else if (!sdi->driver->config_set)
|
||||
ret = SR_ERR_ARG;
|
||||
else
|
||||
ret = sdi->driver->config_set(key, data, sdi);
|
||||
ret = sdi->driver->config_set(key, data, sdi, probe_group);
|
||||
|
||||
g_variant_unref(data);
|
||||
|
||||
|
@ -574,8 +578,10 @@ SR_API int sr_config_set(const struct sr_dev_inst *sdi, int key, GVariant *data)
|
|||
* but this is not to be flagged as an error by the caller; merely
|
||||
* as an indication that it's not applicable.
|
||||
*/
|
||||
SR_API int sr_config_list(const struct sr_dev_driver *driver, int key,
|
||||
GVariant **data, const struct sr_dev_inst *sdi)
|
||||
SR_API int sr_config_list(const struct sr_dev_driver *driver,
|
||||
const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group,
|
||||
int key, GVariant **data)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -583,7 +589,7 @@ SR_API int sr_config_list(const struct sr_dev_driver *driver, int key,
|
|||
ret = SR_ERR;
|
||||
else if (!driver->config_list)
|
||||
ret = SR_ERR_ARG;
|
||||
else if ((ret = driver->config_list(key, data, sdi)) == SR_OK)
|
||||
else if ((ret = driver->config_list(key, data, sdi, probe_group)) == SR_OK)
|
||||
g_variant_ref_sink(*data);
|
||||
|
||||
return ret;
|
||||
|
|
18
libsigrok.h
18
libsigrok.h
|
@ -549,6 +549,13 @@ struct sr_probe {
|
|||
char *trigger;
|
||||
};
|
||||
|
||||
struct sr_probe_group {
|
||||
/* List of sr_probe structs. */
|
||||
GSList *probes;
|
||||
/* Private data for driver use. */
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct sr_config {
|
||||
int key;
|
||||
GVariant *data;
|
||||
|
@ -777,6 +784,8 @@ struct sr_dev_inst {
|
|||
char *model;
|
||||
char *version;
|
||||
GSList *probes;
|
||||
/* List of sr_probe_group structs */
|
||||
GSList *probe_groups;
|
||||
void *conn;
|
||||
void *priv;
|
||||
};
|
||||
|
@ -814,11 +823,14 @@ struct sr_dev_driver {
|
|||
GSList *(*dev_list) (void);
|
||||
int (*dev_clear) (void);
|
||||
int (*config_get) (int id, GVariant **data,
|
||||
const struct sr_dev_inst *sdi);
|
||||
const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group);
|
||||
int (*config_set) (int id, GVariant *data,
|
||||
const struct sr_dev_inst *sdi);
|
||||
const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group);
|
||||
int (*config_list) (int info_id, GVariant **data,
|
||||
const struct sr_dev_inst *sdi);
|
||||
const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group);
|
||||
|
||||
/* Device-specific */
|
||||
int (*dev_open) (struct sr_dev_inst *sdi);
|
||||
|
|
|
@ -69,8 +69,8 @@ static GString *gen_header(const struct sr_dev_inst *sdi, struct context *ctx)
|
|||
GVariant *gvar;
|
||||
int num_enabled_probes;
|
||||
|
||||
if (!ctx->samplerate && sr_config_get(sdi->driver, SR_CONF_SAMPLERATE,
|
||||
&gvar, sdi) == SR_OK) {
|
||||
if (!ctx->samplerate && sr_config_get(sdi->driver, sdi, NULL,
|
||||
SR_CONF_SAMPLERATE, &gvar) == SR_OK) {
|
||||
ctx->samplerate = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
|
|
17
proto.h
17
proto.h
|
@ -70,12 +70,17 @@ SR_API struct sr_dev_driver **sr_driver_list(void);
|
|||
SR_API int sr_driver_init(struct sr_context *ctx,
|
||||
struct sr_dev_driver *driver);
|
||||
SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options);
|
||||
SR_API int sr_config_get(const struct sr_dev_driver *driver, int key,
|
||||
GVariant **data, const struct sr_dev_inst *sdi);
|
||||
SR_API int sr_config_set(const struct sr_dev_inst *sdi, int key,
|
||||
GVariant *data);
|
||||
SR_API int sr_config_list(const struct sr_dev_driver *driver, int key,
|
||||
GVariant **data, const struct sr_dev_inst *sdi);
|
||||
SR_API int sr_config_get(const struct sr_dev_driver *driver,
|
||||
const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group,
|
||||
int key, GVariant **data);
|
||||
SR_API int sr_config_set(const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group,
|
||||
int key, GVariant *data);
|
||||
SR_API int sr_config_list(const struct sr_dev_driver *driver,
|
||||
const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group,
|
||||
int key, GVariant **data);
|
||||
SR_API const struct sr_config_info *sr_config_info_get(int key);
|
||||
SR_API const struct sr_config_info *sr_config_info_name_get(const char *optname);
|
||||
|
||||
|
|
|
@ -202,10 +202,13 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct session_vdev *vdev;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
switch (id) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (sdi) {
|
||||
|
@ -221,10 +224,13 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
struct session_vdev *vdev;
|
||||
|
||||
(void)probe_group;
|
||||
|
||||
vdev = sdi->priv;
|
||||
|
||||
switch (id) {
|
||||
|
@ -253,10 +259,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_probe_group *probe_group)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
(void)probe_group;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_DEVICE_OPTIONS:
|
||||
|
|
|
@ -165,22 +165,22 @@ SR_API int sr_session_load(const char *filename)
|
|||
sr_dev_open(sdi);
|
||||
sr_session_dev_add(sdi);
|
||||
sdi->driver->config_set(SR_CONF_SESSIONFILE,
|
||||
g_variant_new_string(filename), sdi);
|
||||
g_variant_new_string(filename), sdi, NULL);
|
||||
sdi->driver->config_set(SR_CONF_CAPTUREFILE,
|
||||
g_variant_new_string(val), sdi);
|
||||
g_variant_new_string(val), sdi, NULL);
|
||||
g_ptr_array_add(capturefiles, val);
|
||||
} else if (!strcmp(keys[j], "samplerate")) {
|
||||
sr_parse_sizestring(val, &tmp_u64);
|
||||
sdi->driver->config_set(SR_CONF_SAMPLERATE,
|
||||
g_variant_new_uint64(tmp_u64), sdi);
|
||||
g_variant_new_uint64(tmp_u64), sdi, NULL);
|
||||
} else if (!strcmp(keys[j], "unitsize")) {
|
||||
tmp_u64 = strtoull(val, NULL, 10);
|
||||
sdi->driver->config_set(SR_CONF_CAPTURE_UNITSIZE,
|
||||
g_variant_new_uint64(tmp_u64), sdi);
|
||||
g_variant_new_uint64(tmp_u64), sdi, NULL);
|
||||
} else if (!strcmp(keys[j], "total probes")) {
|
||||
total_probes = strtoull(val, NULL, 10);
|
||||
sdi->driver->config_set(SR_CONF_CAPTURE_NUM_PROBES,
|
||||
g_variant_new_uint64(total_probes), sdi);
|
||||
g_variant_new_uint64(total_probes), sdi, NULL);
|
||||
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,
|
||||
|
@ -279,8 +279,8 @@ SR_API int sr_session_save(const char *filename, const struct sr_dev_inst *sdi,
|
|||
fprintf(meta, "unitsize = %d\n", unitsize);
|
||||
fprintf(meta, "total probes = %d\n", g_slist_length(sdi->probes));
|
||||
if (sr_dev_has_option(sdi, SR_CONF_SAMPLERATE)) {
|
||||
if (sr_config_get(sdi->driver, SR_CONF_SAMPLERATE,
|
||||
&gvar, sdi) == SR_OK) {
|
||||
if (sr_config_get(sdi->driver, sdi, NULL,
|
||||
SR_CONF_SAMPLERATE, &gvar) == SR_OK) {
|
||||
samplerate = g_variant_get_uint64(gvar);
|
||||
s = sr_samplerate_string(samplerate);
|
||||
fprintf(meta, "samplerate = %s\n", s);
|
||||
|
|
|
@ -230,7 +230,8 @@ SR_API char **sr_parse_triggerstring(const struct sr_dev_inst *sdi,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (sdi->driver->config_list(SR_CONF_TRIGGER_TYPE, &gvar, sdi) != SR_OK) {
|
||||
if (sdi->driver->config_list(SR_CONF_TRIGGER_TYPE,
|
||||
&gvar, sdi, NULL) != SR_OK) {
|
||||
sr_err("%s: Device doesn't support any triggers.", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue