]> sigrok.org Git - libsigrok.git/blobdiff - src/scpi/scpi_serial.c
scpi/usbtmc: Add Agilent DSO1000 series to RL1 blacklist.
[libsigrok.git] / src / scpi / scpi_serial.c
index 9522c29702305948e2d90c0cbba0c2101253108c..ef507bb499170f67a277f60d88fa16109b3ad861 100644 (file)
@@ -18,6 +18,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <glib.h>
 #include <stdlib.h>
 #include <string.h>
@@ -84,9 +85,9 @@ static int scpi_serial_dev_inst_new(void *priv, struct drv_context *drvc,
        return SR_OK;
 }
 
-static int scpi_serial_open(void *priv)
+static int scpi_serial_open(struct sr_scpi_dev_inst *scpi)
 {
-       struct scpi_serial *sscpi = priv;
+       struct scpi_serial *sscpi = scpi->priv;
        struct sr_serial_dev_inst *serial = sscpi->serial;
 
        if (serial_open(serial, SERIAL_RDWR) != SR_OK)
@@ -162,7 +163,7 @@ static int scpi_serial_read_data(void *priv, char *buf, int maxlen)
 
        /* Try to read new data into the buffer if there is space. */
        if (len > 0) {
-               ret = serial_read_nonblocking(sscpi->serial, sscpi->buffer + sscpi->read,
+               ret = serial_read_nonblocking(sscpi->serial, sscpi->buffer + sscpi->count,
                                BUFFER_SIZE - sscpi->count);
 
                if (ret < 0)
@@ -208,9 +209,9 @@ static int scpi_serial_read_complete(void *priv)
        }
 }
 
-static int scpi_serial_close(void *priv)
+static int scpi_serial_close(struct sr_scpi_dev_inst *scpi)
 {
-       struct scpi_serial *sscpi = priv;
+       struct scpi_serial *sscpi = scpi->priv;
 
        return serial_close(sscpi->serial);
 }