From: Daniel Elstner Date: Wed, 15 Jan 2014 10:09:06 +0000 (+0100) Subject: sysclk-lwla: Make use of the probe index again. X-Git-Tag: libsigrok-0.3.0~277 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=0b92c32cb87f48d5f378b64c787a6f25b65915ad;p=libsigrok.git sysclk-lwla: Make use of the probe index again. (configure_probes): sr_probe::index has been un-deprecated, so use it instead of relying on the list order. --- diff --git a/hardware/sysclk-lwla/api.c b/hardware/sysclk-lwla/api.c index 38e2e970..05010275 100644 --- a/hardware/sysclk-lwla/api.c +++ b/hardware/sysclk-lwla/api.c @@ -357,18 +357,17 @@ static int configure_probes(const struct sr_dev_inst *sdi) devc->trigger_edge_mask = 0; devc->trigger_values = 0; - for (node = sdi->probes, probe_bit = 1; - node != NULL; - node = node->next, probe_bit <<= 1) { - - if (probe_bit >= ((uint64_t)1 << NUM_PROBES)) { - sr_err("Channels over the limit of %d.", NUM_PROBES); - return SR_ERR; - } + for (node = sdi->probes; node != NULL; node = node->next) { probe = node->data; if (!probe || !probe->enabled) continue; + if (probe->index >= NUM_PROBES) { + sr_err("Channel index %d out of range.", probe->index); + return SR_ERR_BUG; + } + probe_bit = (uint64_t)1 << probe->index; + /* Enable input channel for this probe. */ devc->channel_mask |= probe_bit;