From: Andy Lutomirski Date: Sat, 13 Jun 2020 19:03:38 +0000 (-0700) Subject: rigol-ds: Improve short block handling X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=69990295852d658346980f3aad5e52ff0271bcd9;p=libsigrok.git rigol-ds: Improve short block handling When a short block is received, clean up the header state so that the next block can be read. Based on a patch for #1011 by Aleksander Alsekseev. --- diff --git a/src/hardware/rigol-ds/protocol.c b/src/hardware/rigol-ds/protocol.c index 35d7b434..fbbd0320 100644 --- a/src/hardware/rigol-ds/protocol.c +++ b/src/hardware/rigol-ds/protocol.c @@ -691,16 +691,17 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data) sr_dev_acquisition_stop(sdi); return TRUE; } - /* At slow timebases in live capture the DS2072 - * sometimes returns "short" data blocks, with + /* At slow timebases in live capture the DS2072 and + * DS1054Z sometimes return "short" data blocks, with * apparently no way to get the rest of the data. - * Discard these, the complete data block will - * appear eventually. + * Discard these, the complete data block will appear + * eventually. */ if (devc->data_source == DATA_SOURCE_LIVE && (unsigned)len < expected_data_bytes) { - sr_dbg("Discarding short data block"); + sr_dbg("Discarding short data block: got %d/%d bytes\n", len, (int)expected_data_bytes); sr_scpi_read_data(scpi, (char *)devc->buffer, len + 1); + devc->num_header_bytes = 0; return TRUE; } devc->num_block_bytes = len;