From: Martin Ling Date: Sat, 20 Apr 2013 00:00:49 +0000 (+0100) Subject: probe_groups: API changes required to implement probe groups. X-Git-Tag: libsigrok-0.3.0~588 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=8f996b89481670219c7576e2c68b128a0a2ce026;p=libsigrok.git probe_groups: API changes required to implement probe groups. --- diff --git a/device.c b/device.c index b261d6a7..29c721f0 100644 --- a/device.c +++ b/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; diff --git a/hardware/agilent-dmm/api.c b/hardware/agilent-dmm/api.c index 4a1274d6..e67f0e02 100644 --- a/hardware/agilent-dmm/api.c +++ b/hardware/agilent-dmm/api.c @@ -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: diff --git a/hardware/alsa/api.c b/hardware/alsa/api.c index 9bb2ce25..0f54eb48 100644 --- a/hardware/alsa/api.c +++ b/hardware/alsa/api.c @@ -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, diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 52224271..70a9d773 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -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: diff --git a/hardware/brymen-dmm/api.c b/hardware/brymen-dmm/api.c index 7302243e..c03ed668 100644 --- a/hardware/brymen-dmm/api.c +++ b/hardware/brymen-dmm/api.c @@ -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: diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index ec4bf35f..a05a7a94 100644 --- a/hardware/chronovu-la8/api.c +++ b/hardware/chronovu-la8/api.c @@ -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: diff --git a/hardware/colead-slm/api.c b/hardware/colead-slm/api.c index acf0c6eb..98472004 100644 --- a/hardware/colead-slm/api.c +++ b/hardware/colead-slm/api.c @@ -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: diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 68bd4115..b7a07c12 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -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: diff --git a/hardware/fluke-dmm/api.c b/hardware/fluke-dmm/api.c index 4dd49c19..604d65f4 100644 --- a/hardware/fluke-dmm/api.c +++ b/hardware/fluke-dmm/api.c @@ -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: diff --git a/hardware/fx2lafw/api.c b/hardware/fx2lafw/api.c index 1fd59627..d10b6543 100644 --- a/hardware/fx2lafw/api.c +++ b/hardware/fx2lafw/api.c @@ -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: diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index 3a342efc..5d09e80a 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -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; diff --git a/hardware/lascar-el-usb/api.c b/hardware/lascar-el-usb/api.c index 464eb6b1..b699f283 100644 --- a/hardware/lascar-el-usb/api.c +++ b/hardware/lascar-el-usb/api.c @@ -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: diff --git a/hardware/link-mso19/api.c b/hardware/link-mso19/api.c index a22f04a9..6a93ba94 100644 --- a/hardware/link-mso19/api.c +++ b/hardware/link-mso19/api.c @@ -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) { diff --git a/hardware/mic-985xx/api.c b/hardware/mic-985xx/api.c index fa14e2f1..5785e4eb 100644 --- a/hardware/mic-985xx/api.c +++ b/hardware/mic-985xx/api.c @@ -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: diff --git a/hardware/openbench-logic-sniffer/api.c b/hardware/openbench-logic-sniffer/api.c index 73028608..8a83abc7 100644 --- a/hardware/openbench-logic-sniffer/api.c +++ b/hardware/openbench-logic-sniffer/api.c @@ -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: diff --git a/hardware/rigol-ds1xx2/api.c b/hardware/rigol-ds1xx2/api.c index ba59c215..40865950 100644 --- a/hardware/rigol-ds1xx2/api.c +++ b/hardware/rigol-ds1xx2/api.c @@ -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, diff --git a/hardware/serial-dmm/api.c b/hardware/serial-dmm/api.c index daa8a7ca..b394bfa7 100644 --- a/hardware/serial-dmm/api.c +++ b/hardware/serial-dmm/api.c @@ -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: diff --git a/hardware/tondaj-sl-814/api.c b/hardware/tondaj-sl-814/api.c index 4af87648..bb13e289 100644 --- a/hardware/tondaj-sl-814/api.c +++ b/hardware/tondaj-sl-814/api.c @@ -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: diff --git a/hardware/uni-t-dmm/api.c b/hardware/uni-t-dmm/api.c index b23fc02c..84a288b9 100644 --- a/hardware/uni-t-dmm/api.c +++ b/hardware/uni-t-dmm/api.c @@ -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: diff --git a/hardware/victor-dmm/api.c b/hardware/victor-dmm/api.c index e50e3381..97e5f7bd 100644 --- a/hardware/victor-dmm/api.c +++ b/hardware/victor-dmm/api.c @@ -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: diff --git a/hardware/zeroplus-logic-cube/api.c b/hardware/zeroplus-logic-cube/api.c index 637f22ce..3fb156ef 100644 --- a/hardware/zeroplus-logic-cube/api.c +++ b/hardware/zeroplus-logic-cube/api.c @@ -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, diff --git a/hwdriver.c b/hwdriver.c index ff284651..8ae5674c 100644 --- a/hwdriver.c +++ b/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; diff --git a/libsigrok.h b/libsigrok.h index 17d7fc17..32b23380 100644 --- a/libsigrok.h +++ b/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); diff --git a/output/ols.c b/output/ols.c index 67de327c..3c6e5941 100644 --- a/output/ols.c +++ b/output/ols.c @@ -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); } diff --git a/proto.h b/proto.h index 2c078a7c..7ec6ae4f 100644 --- a/proto.h +++ b/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); diff --git a/session_driver.c b/session_driver.c index 8090df9d..b7a10a0f 100644 --- a/session_driver.c +++ b/session_driver.c @@ -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: diff --git a/session_file.c b/session_file.c index 6cd9b720..0e7ad2d8 100644 --- a/session_file.c +++ b/session_file.c @@ -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); diff --git a/strutil.c b/strutil.c index 6cb13a6a..f6cdb73b 100644 --- a/strutil.c +++ b/strutil.c @@ -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; }