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.
This commit is contained in:
Philipp Marek 2017-12-20 16:10:59 +01:00 committed by Uwe Hermann
parent 12f62ce620
commit 8f484ca78e
1 changed files with 2 additions and 1 deletions

View File

@ -792,7 +792,7 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
packet.type = SR_DF_FRAME_END; packet.type = SR_DF_FRAME_END;
sr_session_send(sdi, &packet); 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 */ /* Terminate session */
devc->dev_state = STOPPING; devc->dev_state = STOPPING;
} else { } else {
@ -947,6 +947,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
devc = sdi->priv; devc = sdi->priv;
devc->dev_state = STOPPING; devc->dev_state = STOPPING;
devc->num_frames = 0;
return SR_OK; return SR_OK;
} }