From: Martin Ling Date: Tue, 14 Jan 2014 20:48:17 +0000 (+0000) Subject: rigol-ds: Fix check for probe group validity. X-Git-Tag: libsigrok-0.3.0~259 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=969edf63068d19260381274cfa4fecf6a390345b;p=libsigrok.git rigol-ds: Fix check for probe group validity. --- diff --git a/hardware/rigol-ds/api.c b/hardware/rigol-ds/api.c index de4d8a37..1e2b001a 100644 --- a/hardware/rigol-ds/api.c +++ b/hardware/rigol-ds/api.c @@ -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;