]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: Fix check for probe group validity.
authorMartin Ling <redacted>
Tue, 14 Jan 2014 20:48:17 +0000 (20:48 +0000)
committerUwe Hermann <redacted>
Fri, 17 Jan 2014 00:52:29 +0000 (01:52 +0100)
hardware/rigol-ds/api.c

index de4d8a376ed838ad37b340c492b60d926126a9ec..1e2b001a48e17d8474228b680921fac335b28ef3 100644 (file)
@@ -464,12 +464,10 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
                return SR_ERR_ARG;
 
        /* If a probe group is specified, it must be a valid one. */
-       if (probe_group) {
-               if (probe_group != &devc->analog_groups[0]
-                               && probe_group != &devc->analog_groups[1]) {
-                       sr_err("Invalid probe group specified.");
-                       return SR_ERR;
-               }
+       if (probe_group && !g_slist_find(sdi->probe_groups, probe_group))
+       {
+               sr_err("Invalid probe group specified.");
+               return SR_ERR;
        }
 
        switch (id) {
@@ -510,12 +508,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
                return SR_ERR_DEV_CLOSED;
 
        /* If a probe group is specified, it must be a valid one. */
-       if (probe_group) {
-               if (probe_group != &devc->analog_groups[0]
-                               && probe_group != &devc->analog_groups[1]) {
-                       sr_err("Invalid probe group specified.");
-                       return SR_ERR;
-               }
+       if (probe_group && !g_slist_find(sdi->probe_groups, probe_group))
+       {
+               sr_err("Invalid probe group specified.");
+               return SR_ERR;
        }
 
        ret = SR_OK;