From: Alexandru Gagniuc Date: Sat, 22 Dec 2012 22:00:44 +0000 (-0600) Subject: serial-dmm: Properly handle continuous mode X-Git-Tag: dsupstream~428 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d55c89f523e74a2f629bb23e8fd9bf6db7e3758a;p=libsigrok.git serial-dmm: Properly handle continuous mode serial-dmm does not check if a sample limit is actually in place before deciding to stop acquisition. Since the sample limit is set at 0 by default, operating in continuous mode will cause acquisition to stop before even sending the first sample. Check to make sure we actually are in a sample-limited mode before stopping for this reason. Signed-off-by: Alexandru Gagniuc --- diff --git a/hardware/serial-dmm/protocol.c b/hardware/serial-dmm/protocol.c index d10eec26..09f74dd4 100644 --- a/hardware/serial-dmm/protocol.c +++ b/hardware/serial-dmm/protocol.c @@ -177,7 +177,7 @@ static int receive_data(int fd, int revents, int dmm, void *info, void *cb_data) } } - if (devc->num_samples >= devc->limit_samples) { + if (devc->limit_samples && devc->num_samples >= devc->limit_samples) { sr_info("Requested number of samples reached, stopping."); sdi->driver->dev_acquisition_stop(sdi, cb_data); return TRUE;