From: Bert Vermeulen Date: Thu, 31 Oct 2013 22:58:33 +0000 (+0100) Subject: probe_groups: API changes required to implement probe groups. X-Git-Tag: libsigrok-0.3.0~575 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d3c74a6fb05118e32ad421443251b7b3288918f9;p=libsigrok.git probe_groups: API changes required to implement probe groups. --- diff --git a/hardware/cem-dt-885x/api.c b/hardware/cem-dt-885x/api.c index 62001a5b..6628d93d 100644 --- a/hardware/cem-dt-885x/api.c +++ b/hardware/cem-dt-885x/api.c @@ -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) { diff --git a/hardware/center-3xx/api.c b/hardware/center-3xx/api.c index 6c01f4ca..4cd8ab12 100644 --- a/hardware/center-3xx/api.c +++ b/hardware/center-3xx/api.c @@ -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: diff --git a/hardware/ikalogic-scanalogic2/api.c b/hardware/ikalogic-scanalogic2/api.c index 4f1d09fb..1fe869c3 100644 --- a/hardware/ikalogic-scanalogic2/api.c +++ b/hardware/ikalogic-scanalogic2/api.c @@ -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; diff --git a/hardware/ikalogic-scanaplus/api.c b/hardware/ikalogic-scanaplus/api.c index 4d411b63..ba5b1b11 100644 --- a/hardware/ikalogic-scanaplus/api.c +++ b/hardware/ikalogic-scanaplus/api.c @@ -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: diff --git a/hardware/kecheng-kc-330b/api.c b/hardware/kecheng-kc-330b/api.c index 02f4b0e0..9355e6dc 100644 --- a/hardware/kecheng-kc-330b/api.c +++ b/hardware/kecheng-kc-330b/api.c @@ -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: diff --git a/hardware/norma-dmm/api.c b/hardware/norma-dmm/api.c index 991a839b..6523e93a 100644 --- a/hardware/norma-dmm/api.c +++ b/hardware/norma-dmm/api.c @@ -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: diff --git a/hardware/saleae-logic16/api.c b/hardware/saleae-logic16/api.c index dfcbe047..e399729e 100644 --- a/hardware/saleae-logic16/api.c +++ b/hardware/saleae-logic16/api.c @@ -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) { diff --git a/hardware/teleinfo/api.c b/hardware/teleinfo/api.c index 604dec7c..d129987d 100644 --- a/hardware/teleinfo/api.c +++ b/hardware/teleinfo/api.c @@ -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: diff --git a/hardware/uni-t-ut32x/api.c b/hardware/uni-t-ut32x/api.c index c3ef49a7..8d4e7221 100644 --- a/hardware/uni-t-ut32x/api.c +++ b/hardware/uni-t-ut32x/api.c @@ -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: diff --git a/output/chronovu_la8.c b/output/chronovu_la8.c index 8029da1b..54fbfa34 100644 --- a/output/chronovu_la8.c +++ b/output/chronovu_la8.c @@ -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 diff --git a/output/csv.c b/output/csv.c index 57cfb821..3eda9bf9 100644 --- a/output/csv.c +++ b/output/csv.c @@ -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 diff --git a/output/gnuplot.c b/output/gnuplot.c index 23e0212b..e93556f8 100644 --- a/output/gnuplot.c +++ b/output/gnuplot.c @@ -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))) { diff --git a/output/text/text.c b/output/text/text.c index a2b8b20e..9be33974 100644 --- a/output/text/text.c +++ b/output/text/text.c @@ -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))) { diff --git a/output/vcd.c b/output/vcd.c index 04d7fcbb..8e2d1b21 100644 --- a/output/vcd.c +++ b/output/vcd.c @@ -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)))) {