From: Aurelien Jacobs Date: Fri, 3 Jan 2014 16:50:16 +0000 (+0100) Subject: scpi_usbtmc: fix reading of blocks bigger than the 2048 bytes buffer X-Git-Tag: libsigrok-0.3.0~337 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=8ae157d976d9825f77c46b1cfa9ecaeacad25436;p=libsigrok.git scpi_usbtmc: fix reading of blocks bigger than the 2048 bytes buffer --- diff --git a/hardware/common/scpi_usbtmc.c b/hardware/common/scpi_usbtmc.c index 5aa0dbbd..dba1a2e3 100644 --- a/hardware/common/scpi_usbtmc.c +++ b/hardware/common/scpi_usbtmc.c @@ -113,6 +113,11 @@ SR_PRIV int scpi_usbtmc_read_data(void *priv, char *buf, int maxlen) struct usbtmc_scpi *uscpi = priv; int read_length; + if (uscpi->response_length == MAX_READ_LENGTH + && uscpi->response_bytes_read == uscpi->response_length) + if (scpi_usbtmc_read_begin(uscpi) != SR_OK) + return SR_ERR; + if (uscpi->response_bytes_read >= uscpi->response_length) return SR_ERR; @@ -132,6 +137,10 @@ SR_PRIV int scpi_usbtmc_read_complete(void *priv) { struct usbtmc_scpi *uscpi = priv; + if (uscpi->response_length == MAX_READ_LENGTH + && uscpi->response_bytes_read == uscpi->response_length) + scpi_usbtmc_read_begin(uscpi); + return (uscpi->response_bytes_read >= uscpi->response_length); }