From 8f484ca78ef8603f854ad80df02f251631dc1330 Mon Sep 17 00:00:00 2001 From: Philipp Marek Date: Wed, 20 Dec 2017 16:10:59 +0100 Subject: [PATCH] hantek-dso: dso2250: Fix capture runaway, only do the requested number of frames. After the first capture ->num_frames never got to be _equal_ to ->limit_frames; fixed by resetting to zero in dev_acquisition_stop(), and protected against similar problems in the future by switching to greater-or-equal instead. --- src/hardware/hantek-dso/api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hardware/hantek-dso/api.c b/src/hardware/hantek-dso/api.c index 663cd55d..d1731552 100644 --- a/src/hardware/hantek-dso/api.c +++ b/src/hardware/hantek-dso/api.c @@ -792,7 +792,7 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer) packet.type = SR_DF_FRAME_END; sr_session_send(sdi, &packet); - if (devc->limit_frames && ++devc->num_frames == devc->limit_frames) { + if (devc->limit_frames && ++devc->num_frames >= devc->limit_frames) { /* Terminate session */ devc->dev_state = STOPPING; } else { @@ -947,6 +947,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) devc = sdi->priv; devc->dev_state = STOPPING; + devc->num_frames = 0; return SR_OK; }