X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fscpi%2Fscpi_serial.c;h=ef507bb499170f67a277f60d88fa16109b3ad861;hb=98654c99daf85bd2a81a9c87f517e800c31e34f2;hp=9522c29702305948e2d90c0cbba0c2101253108c;hpb=5a1afc0907abfee5848484f944789213d6be9752;p=libsigrok.git
diff --git a/src/scpi/scpi_serial.c b/src/scpi/scpi_serial.c
index 9522c297..ef507bb4 100644
--- a/src/scpi/scpi_serial.c
+++ b/src/scpi/scpi_serial.c
@@ -18,6 +18,7 @@
* along with this program. If not, see .
*/
+#include
#include
#include
#include
@@ -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);
}