]> sigrok.org Git - libsigrok.git/commitdiff
hantek-dso: dso2250: Fix capture runaway, only do the requested number of frames.
authorPhilipp Marek <redacted>
Wed, 20 Dec 2017 15:10:59 +0000 (16:10 +0100)
committerUwe Hermann <redacted>
Thu, 11 Jan 2018 01:21:50 +0000 (02:21 +0100)
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

index 663cd55dfcd668e732313b2a613be21015219469..d173155282feeeeffc8e7e39de1a13689ef1de0a 100644 (file)
@@ -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;
 }