X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Flecroy-xstream%2Fprotocol.c;h=8a2129a71bb28ecd3b5291cba8f1a3e8bcdd8897;hb=2377246220f2d48e341e5b1286a44818eab789d8;hp=1cbf036e8f1c9689eae9e30c4b9a8b06e4623789;hpb=24985129729715ee08cdc021b1d5e552c6b6b312;p=libsigrok.git diff --git a/src/hardware/lecroy-xstream/protocol.c b/src/hardware/lecroy-xstream/protocol.c index 1cbf036e..8a2129a7 100644 --- a/src/hardware/lecroy-xstream/protocol.c +++ b/src/hardware/lecroy-xstream/protocol.c @@ -92,11 +92,11 @@ static const char *trigger_sources[] = { static const uint64_t timebases[][2] = { /* picoseconds */ - { 20, 1000000000000 }, - { 50, 1000000000000 }, - { 100, 1000000000000 }, - { 200, 1000000000000 }, - { 500, 1000000000000 }, + { 20, UINT64_C(1000000000000) }, + { 50, UINT64_C(1000000000000) }, + { 100, UINT64_C(1000000000000) }, + { 200, UINT64_C(1000000000000) }, + { 500, UINT64_C(1000000000000) }, /* nanoseconds */ { 1, 1000000000 }, { 2, 1000000000 }, @@ -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); @@ -674,8 +676,10 @@ SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data) } else { /* Update sample rate if needed. */ if (state->sample_rate == 0) - if (lecroy_xstream_update_sample_rate(sdi, analog.num_samples) != SR_OK) + if (lecroy_xstream_update_sample_rate(sdi, analog.num_samples) != SR_OK) { + g_free(analog.data); return SR_ERR; + } } /* @@ -722,6 +726,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); }