]> sigrok.org Git - libsigrok.git/blobdiff - src/scpi/scpi_libgpib.c
scpi: Pass SCPI device instance to open and close callbacks.
[libsigrok.git] / src / scpi / scpi_libgpib.c
index 67d6b003810f0290905837ae04397dce17aea4b7..7632f74c9dc2ecf530986011ae02b08dd402f8cc 100644 (file)
@@ -49,9 +49,9 @@ static int scpi_gpib_dev_inst_new(void *priv, struct drv_context *drvc,
        return SR_OK;
 }
 
-static int scpi_gpib_open(void *priv)
+static int scpi_gpib_open(struct sr_scpi_dev_inst *scpi)
 {
-       struct scpi_gpib *gscpi = priv;
+       struct scpi_gpib *gscpi = scpi->priv;
 
        if ((gscpi->descriptor = ibfind(gscpi->name)) < 0)
                return SR_ERR;
@@ -92,7 +92,7 @@ static int scpi_gpib_send(void *priv, const char *command)
        if (ibcnt < len)
        {
                sr_err("Failed to send all of SCPI command: '%s': "
-                               "len = %d, ibcnt = .", command, len, ibcnt);
+                               "len = %d, ibcnt = %d.", command, len, ibcnt);
                return SR_ERR;
        }
 
@@ -134,9 +134,9 @@ static int scpi_gpib_read_complete(void *priv)
        return gscpi->read_started && (ibsta & END);
 }
 
-static int scpi_gpib_close(void *priv)
+static int scpi_gpib_close(struct sr_scpi_dev_inst *scpi)
 {
-       struct scpi_gpib *gscpi = priv;
+       struct scpi_gpib *gscpi = scpi->priv;
 
        ibonl(gscpi->descriptor, 0);