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 <[email protected]>
---
 libsigrok/hardware/demo/demo.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libsigrok/hardware/demo/demo.c b/libsigrok/hardware/demo/demo.c
index e511c0a..eb55478 100644
--- a/libsigrok/hardware/demo/demo.c
+++ b/libsigrok/hardware/demo/demo.c
@@ -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;
-- 
1.7.10


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to