From: Philipp Marek Date: Wed, 20 Dec 2017 15:10:59 +0000 (+0100) Subject: hantek-dso: dso2250: Fix capture runaway, only do the requested number of frames. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=8f484ca78ef8603f854ad80df02f251631dc1330;p=libsigrok.git 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. --- 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; }