scpi_usbtmc: fix reading of blocks bigger than the 2048 bytes buffer

This commit is contained in:
Aurelien Jacobs 2014-01-03 17:50:16 +01:00
parent a53278de01
commit 8ae157d976
1 changed files with 9 additions and 0 deletions

View File

@ -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);
}