probe_groups: API changes required to implement probe groups.

This commit is contained in:
Bert Vermeulen 2013-10-31 23:58:33 +01:00 committed by Uwe Hermann
parent ba358ffd83
commit d3c74a6fb0
14 changed files with 96 additions and 34 deletions

View File

@ -183,13 +183,16 @@ static int cleanup(void)
return dev_clear();
}
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi)
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_probe_group *probe_group)
{
struct dev_context *devc;
GVariant *range[2];
uint64_t low, high;
int tmp, ret;
(void)probe_group;
if (!sdi)
return SR_ERR_ARG;
@ -252,7 +255,8 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi)
return ret;
}
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi)
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_probe_group *probe_group)
{
struct dev_context *devc;
uint64_t tmp_u64, low, high;
@ -260,6 +264,8 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi)
int tmp, ret;
const char *tmp_str;
(void)probe_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
@ -339,7 +345,8 @@ static int config_set(int key, 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, *range[2];
GVariantBuilder gvb;
@ -347,6 +354,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
int ret;
(void)sdi;
(void)probe_group;
ret = SR_OK;
switch (key) {

View File

@ -186,10 +186,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;
@ -213,9 +216,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:

View File

@ -307,11 +307,14 @@ static int cleanup(void)
return dev_clear();
}
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi)
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_probe_group *probe_group)
{
struct dev_context *devc;
int ret;
(void)probe_group;
ret = SR_OK;
devc = sdi->priv;
@ -329,11 +332,14 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi)
return ret;
}
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi)
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_probe_group *probe_group)
{
uint64_t samplerate, limit_samples, capture_ratio;
int ret;
(void)probe_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
@ -359,13 +365,15 @@ static int config_set(int key, 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;
int ret;
(void)sdi;
(void)probe_group;
ret = SR_OK;

View File

@ -279,9 +279,11 @@ 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_SAMPLERATE:
@ -295,10 +297,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;
@ -329,12 +334,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:

View File

@ -252,12 +252,15 @@ static int cleanup(void)
return ret;
}
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi)
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_probe_group *probe_group)
{
struct dev_context *devc;
GVariant *rational[2];
const uint64_t *si;
(void)probe_group;
devc = sdi->priv;
switch (key) {
case SR_CONF_LIMIT_SAMPLES:
@ -298,7 +301,8 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi)
return SR_OK;
}
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi)
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_probe_group *probe_group)
{
struct dev_context *devc;
uint64_t p, q;
@ -306,6 +310,8 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi)
int tmp, ret;
const char *tmp_str;
(void)probe_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
@ -375,13 +381,15 @@ static int config_set(int key, 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;
(void)sdi;
(void)probe_group;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:

View File

@ -207,10 +207,13 @@ static int cleanup(void)
return dev_clear();
}
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi)
static int config_set(int key, 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;
@ -242,9 +245,11 @@ static int config_set(int key, 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:

View File

@ -431,7 +431,8 @@ static int cleanup(void)
return ret;
}
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi)
static int config_get(int key, 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;
@ -440,6 +441,8 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi)
int ret;
unsigned int i;
(void)probe_group;
ret = SR_OK;
switch (key) {
case SR_CONF_CONN:
@ -482,13 +485,16 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi)
return ret;
}
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi)
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_probe_group *probe_group)
{
struct dev_context *devc;
gdouble low, high;
int ret;
unsigned int i;
(void)probe_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
@ -522,7 +528,8 @@ static int config_set(int key, 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, *range[2];
GVariantBuilder gvb;
@ -530,6 +537,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
unsigned int i;
(void)sdi;
(void)probe_group;
ret = SR_OK;
switch (key) {

View File

@ -203,10 +203,13 @@ static int cleanup(void)
return dev_clear();
}
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi)
static int config_set(int key, 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;
@ -231,9 +234,11 @@ static int config_set(int key, 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:

View File

@ -203,10 +203,13 @@ static int cleanup(void)
return ret;
}
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi)
static int config_get(int key, 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 (key) {
case SR_CONF_LIMIT_SAMPLES:
@ -225,12 +228,15 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi)
return SR_OK;
}
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi)
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_probe_group *probe_group)
{
struct dev_context *devc;
int ret;
const char *tmp_str;
(void)probe_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
@ -263,10 +269,12 @@ static int config_set(int key, 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_DEVICE_OPTIONS:

View File

@ -121,8 +121,8 @@ static int init(struct sr_output *o)
}
ctx->unitsize = (ctx->num_enabled_probes + 7) / 8;
if (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar,
o->sdi) == SR_OK) {
if (sr_config_get(o->sdi->driver, o->sdi, NULL, SR_CONF_SAMPLERATE,
&gvar) == SR_OK) {
ctx->samplerate = g_variant_get_uint64(gvar);
g_variant_unref(gvar);
} else

View File

@ -91,8 +91,8 @@ static int init(struct sr_output *o)
num_probes = g_slist_length(o->sdi->probes);
if (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar,
o->sdi) == SR_OK) {
if (sr_config_get(o->sdi->driver, o->sdi, NULL, SR_CONF_SAMPLERATE,
&gvar) == SR_OK) {
ctx->samplerate = g_variant_get_uint64(gvar);
g_variant_unref(gvar);
} else

View File

@ -95,8 +95,8 @@ static int init(struct sr_output *o)
num_probes = g_slist_length(o->sdi->probes);
comment[0] = '\0';
samplerate = 0;
if (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar,
o->sdi) == SR_OK) {
if (sr_config_get(o->sdi->driver, o->sdi, NULL, SR_CONF_SAMPLERATE,
&gvar) == SR_OK) {
samplerate = g_variant_get_uint64(gvar);
g_variant_unref(gvar);
if (!(frequency_s = sr_samplerate_string(samplerate))) {

View File

@ -129,8 +129,8 @@ 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 (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar,
o->sdi) == SR_OK) {
if (sr_config_get(o->sdi->driver, o->sdi, NULL, SR_CONF_SAMPLERATE,
&gvar) == SR_OK) {
samplerate = g_variant_get_uint64(gvar);
g_variant_unref(gvar);
if (!(samplerate_s = sr_samplerate_string(samplerate))) {

View File

@ -95,8 +95,8 @@ static int init(struct sr_output *o)
g_string_append_printf(ctx->header, "$version %s %s $end\n",
PACKAGE, PACKAGE_VERSION);
if (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar,
o->sdi) == SR_OK) {
if (sr_config_get(o->sdi->driver, o->sdi, NULL, SR_CONF_SAMPLERATE,
&gvar) == SR_OK) {
ctx->samplerate = g_variant_get_uint64(gvar);
g_variant_unref(gvar);
if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) {