]> sigrok.org Git - libsigrok.git/commitdiff
hantek-4032l: config_set(): Simplify SR_CONF_CAPTURE_RATIO case.
authorUwe Hermann <redacted>
Tue, 5 Jun 2018 21:14:51 +0000 (23:14 +0200)
committerUwe Hermann <redacted>
Tue, 5 Jun 2018 21:16:02 +0000 (23:16 +0200)
The sr_config_set() wrapper already checks the value.

src/hardware/hantek-4032l/api.c

index 5242a76e46b490299d7d9f1d5109c49b9dee19d6..14cd59f37c127407d12ca91b6153cdf58703362a 100644 (file)
@@ -393,7 +393,7 @@ static int config_set(uint32_t key, GVariant *data,
        int idx;
        struct dev_context *devc = sdi->priv;
        struct h4032l_cmd_pkt *cmd_pkt = &devc->cmd_pkt;
-       uint64_t sample_rate, capture_ratio, number_samples;
+       uint64_t sample_rate, number_samples;
        double low, high, threshold;
 
        switch (key) {
@@ -409,12 +409,7 @@ static int config_set(uint32_t key, GVariant *data,
                devc->sample_rate = idx;
                break;
        case SR_CONF_CAPTURE_RATIO:
-               capture_ratio = g_variant_get_uint64(data);
-               if (capture_ratio > 99) {
-                       sr_err("Invalid capture ratio.");
-                       return SR_ERR;
-               }
-               devc->capture_ratio = capture_ratio;
+               devc->capture_ratio = g_variant_get_uint64(data);
                break;
        case SR_CONF_LIMIT_SAMPLES:
                number_samples = g_variant_get_uint64(data);