]> sigrok.org Git - libsigrok.git/commitdiff
scpi_usbtmc: fix reading of blocks bigger than the 2048 bytes buffer
authorAurelien Jacobs <redacted>
Fri, 3 Jan 2014 16:50:16 +0000 (17:50 +0100)
committerAurelien Jacobs <redacted>
Fri, 3 Jan 2014 16:54:47 +0000 (17:54 +0100)
hardware/common/scpi_usbtmc.c

index 5aa0dbbd335d323dd20615984a59f9294069f7c5..dba1a2e327772b30912c05f683868b6806d8152b 100644 (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);
 }