X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fsysclk-lwla%2Fapi.c;h=05010275c7db664b7652071149892c2e25cde032;hb=23e1ea7a7d862a8f5173dd12c62d6a4b2e7e9015;hp=e20564a56232cee28ceb13e590f6bf67a56dc4cb;hpb=7ebe9b9e7e8649fa592527d7cba2cf49804c3652;p=libsigrok.git diff --git a/hardware/sysclk-lwla/api.c b/hardware/sysclk-lwla/api.c index e20564a5..05010275 100644 --- a/hardware/sysclk-lwla/api.c +++ b/hardware/sysclk-lwla/api.c @@ -65,7 +65,7 @@ static GSList *gen_probe_list(int num_probes) for (i = num_probes; i > 0; --i) { /* The LWLA series simply number probes from CH1 to CHxx. */ - g_ascii_formatd(name, sizeof name, "CH%.0f", i); + g_snprintf(name, sizeof(name), "CH%d", i); probe = sr_probe_new(i - 1, SR_PROBE_LOGIC, TRUE, name); list = g_slist_prepend(list, probe); @@ -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;