X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Flecroy-xstream%2Fprotocol.c;h=0c16129f2b4102808c7edc103040c6243459a2b1;hb=f62c2ad65d3c2e20eba512d6460c9c48e17cca08;hp=5fa1b44a63d3e64acdf18ef447ec8eeb68b1a08f;hpb=e0b6855bd4daca9f1a27b8e4e0d16b019d5d54e4;p=libsigrok.git diff --git a/src/hardware/lecroy-xstream/protocol.c b/src/hardware/lecroy-xstream/protocol.c index 5fa1b44a..0c16129f 100644 --- a/src/hardware/lecroy-xstream/protocol.c +++ b/src/hardware/lecroy-xstream/protocol.c @@ -665,6 +665,8 @@ SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data) return SR_ERR; if (analog.num_samples == 0) { + g_free(analog.data); + /* No data available, we have to acquire data first. */ g_snprintf(command, sizeof(command), "ARM;WAIT;*OPC;C%d:WAVEFORM?", ch->index + 1); sr_scpi_send(sdi->conn, command); @@ -717,10 +719,16 @@ SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data) * number of frames, or continue reception by starting over at * the first enabled channel. */ - if (++devc->num_frames == devc->frame_limit) { + devc->num_frames++; + if (devc->frame_limit && (devc->num_frames == devc->frame_limit)) { sr_dev_acquisition_stop(sdi); } else { devc->current_channel = devc->enabled_channels; + + /* Wait for trigger, then begin fetching data. */ + g_snprintf(command, sizeof(command), "ARM;WAIT;*OPC"); + sr_scpi_send(sdi->conn, command); + lecroy_xstream_request_data(sdi); }