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.
This commit is contained in:
parent
16e96ca3af
commit
6999029585
|
@ -691,16 +691,17 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
|
||||||
sr_dev_acquisition_stop(sdi);
|
sr_dev_acquisition_stop(sdi);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/* At slow timebases in live capture the DS2072
|
/* At slow timebases in live capture the DS2072 and
|
||||||
* sometimes returns "short" data blocks, with
|
* DS1054Z sometimes return "short" data blocks, with
|
||||||
* apparently no way to get the rest of the data.
|
* apparently no way to get the rest of the data.
|
||||||
* Discard these, the complete data block will
|
* Discard these, the complete data block will appear
|
||||||
* appear eventually.
|
* eventually.
|
||||||
*/
|
*/
|
||||||
if (devc->data_source == DATA_SOURCE_LIVE
|
if (devc->data_source == DATA_SOURCE_LIVE
|
||||||
&& (unsigned)len < expected_data_bytes) {
|
&& (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);
|
sr_scpi_read_data(scpi, (char *)devc->buffer, len + 1);
|
||||||
|
devc->num_header_bytes = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
devc->num_block_bytes = len;
|
devc->num_block_bytes = len;
|
||||||
|
|
Loading…
Reference in New Issue