]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/lecroy-xstream/protocol.c
lecroy-xstream: fix several compiler warnings (assignment, memory)
[libsigrok.git] / src / hardware / lecroy-xstream / protocol.c
index 1cbf036e8f1c9689eae9e30c4b9a8b06e4623789..0c16129f2b4102808c7edc103040c6243459a2b1 100644 (file)
@@ -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);
@@ -722,6 +724,11 @@ SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data)
                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);
        }