]> sigrok.org Git - libsigrok.git/commitdiff
dslogic: Fix incorrect samplerate setting.
authorCarl-Fredrik Sundström <redacted>
Mon, 22 Jun 2015 14:53:51 +0000 (16:53 +0200)
committerUwe Hermann <redacted>
Mon, 22 Jun 2015 14:54:39 +0000 (16:54 +0200)
src/hardware/fx2lafw/api.c

index ab3345f32cc81db6758261e48e1cd5423867b554..a93b9a418944327edd00d3b8d32d6f82e828154c 100644 (file)
@@ -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: