]> sigrok.org Git - libsigrok.git/commitdiff
hantek-dso: config_set(): Shorten SR_CONF_CAPTURE_RATIO case.
authorUwe Hermann <redacted>
Wed, 10 Jan 2018 21:16:37 +0000 (22:16 +0100)
committerUwe Hermann <redacted>
Thu, 11 Jan 2018 01:21:50 +0000 (02:21 +0100)
The sr_config_set() wrapper already checks for SR_CONF_CAPTURE_RATIO
being 0..100.

src/hardware/hantek-dso/api.c

index 8d3e037ee8be8ed4d1a09270720c5240caaa10f6..48beebfcadce98de9217bb6124a807c7e8881555 100644 (file)
@@ -506,7 +506,6 @@ static int config_set(uint32_t key, GVariant *data,
        const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
-       int rat;
        int ch_idx, idx;
        float flt;
 
@@ -532,12 +531,7 @@ static int config_set(uint32_t key, GVariant *data,
                        devc->triggerslope = idx;
                        break;
                case SR_CONF_CAPTURE_RATIO:
-                       rat = g_variant_get_uint64(data);
-                       if (rat < 0 || rat > 100) {
-                               sr_err("Capture ratio must be in [0,100].");
-                               return SR_ERR_ARG;
-                       } else
-                               devc->capture_ratio = rat;
+                       devc->capture_ratio = g_variant_get_uint64(data);
                        break;
                case SR_CONF_BUFFERSIZE:
                        if ((idx = std_u64_idx(data, devc->profile->buffersizes, NUM_BUFFER_SIZES)) < 0)