From: Carl-Fredrik Sundström Date: Mon, 22 Jun 2015 14:53:51 +0000 (+0200) Subject: dslogic: Fix incorrect samplerate setting. X-Git-Tag: libsigrok-0.4.0~485 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=65e0036635a54b3273436b4ea7918aea25bad788;p=libsigrok.git dslogic: Fix incorrect samplerate setting. --- diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index ab3345f3..a93b9a41 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -501,8 +501,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd { struct dev_context *devc; uint64_t arg; - unsigned int i; - int ret; + int i, ret; (void)cg; @@ -519,13 +518,13 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd switch (key) { case SR_CONF_SAMPLERATE: arg = g_variant_get_uint64(data); - for (i = 0; i < ARRAY_SIZE(samplerates); i++) { - if (samplerates[i] == arg) { + for (i = 0; i < devc->num_samplerates; i++) { + if (devc->samplerates[i] == arg) { devc->cur_samplerate = arg; break; } } - if (i == ARRAY_SIZE(samplerates)) + if (i == devc->num_samplerates) ret = SR_ERR_ARG; break; case SR_CONF_LIMIT_SAMPLES: