]> sigrok.org Git - libsigrok.git/commitdiff
sr: demodevice: Reset sample limit when setting time limit and vice versa
authorLars-Peter Clausen <redacted>
Tue, 3 Jul 2012 21:59:12 +0000 (23:59 +0200)
committerBert Vermeulen <redacted>
Tue, 3 Jul 2012 23:11:50 +0000 (01:11 +0200)
Only one limit should be active at a time. Make sure that the sample limit is
disabled when a time limit is set and vice versa.

Signed-off-by: Lars-Peter Clausen <redacted>
hardware/demo/demo.c

index e511c0a6fac22340ee8a860cac571836ae0d0b22..eb5547875647eba9b4a11dd820bbed23c0dcea18 100644 (file)
@@ -248,12 +248,14 @@ static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
                       cur_samplerate);
                ret = SR_OK;
        } else if (hwcap == SR_HWCAP_LIMIT_SAMPLES) {
+               limit_msec = 0;
                limit_samples = *(const uint64_t *)value;
                sr_dbg("demo: %s: setting limit_samples to %" PRIu64, __func__,
                       limit_samples);
                ret = SR_OK;
        } else if (hwcap == SR_HWCAP_LIMIT_MSEC) {
                limit_msec = *(const uint64_t *)value;
+               limit_samples = 0;
                sr_dbg("demo: %s: setting limit_msec to %" PRIu64, __func__,
                       limit_msec);
                ret = SR_OK;