From: Martin Ling Date: Wed, 22 Jan 2014 04:50:38 +0000 (+0000) Subject: rigol-ds: Improve protocol debugging output, abort on read errors. X-Git-Tag: libsigrok-0.3.0~201 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=ae3a1913665dcdd721c88a46bc93c5e86747b519 rigol-ds: Improve protocol debugging output, abort on read errors. --- diff --git a/hardware/rigol-ds/protocol.c b/hardware/rigol-ds/protocol.c index 8c66d63e..fd8ba96b 100644 --- a/hardware/rigol-ds/protocol.c +++ b/hardware/rigol-ds/protocol.c @@ -535,12 +535,16 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data) } len = devc->num_block_bytes - devc->num_block_read; - len = sr_scpi_read_data(scpi, (char *)devc->buffer, - len < ACQ_BUFFER_SIZE ? len : ACQ_BUFFER_SIZE); + if (len > ACQ_BUFFER_SIZE) + len = ACQ_BUFFER_SIZE; + sr_dbg("Requesting read of %d bytes", len); + + len = sr_scpi_read_data(scpi, (char *)devc->buffer, len); - sr_dbg("Received %d bytes.", len); if (len == -1) - return TRUE; + return FALSE; + + sr_dbg("Received %d bytes.", len); devc->num_block_read += len;