X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fscpi%2Fscpi_vxi.c;h=8a99ec7474b3e5cee740f9e6367e0faa4651d315;hb=2c24077466a299ead689c90f01f55f6d86c7386b;hp=e28a77a3d857587c9d8620576e8583d59a1dc0f8;hpb=5a1afc0907abfee5848484f944789213d6be9752;p=libsigrok.git diff --git a/src/scpi/scpi_vxi.c b/src/scpi/scpi_vxi.c index e28a77a3..8a99ec74 100644 --- a/src/scpi/scpi_vxi.c +++ b/src/scpi/scpi_vxi.c @@ -20,9 +20,10 @@ * along with this program. If not, see . */ +#include +#include "vxi.h" #include #include -#include "vxi.h" #include #include "libsigrok-internal.h" #include "scpi.h" @@ -59,9 +60,9 @@ static int scpi_vxi_dev_inst_new(void *priv, struct drv_context *drvc, return SR_OK; } -static int scpi_vxi_open(void *priv) +static int scpi_vxi_open(struct sr_scpi_dev_inst *scpi) { - struct scpi_vxi *vxi = priv; + struct scpi_vxi *vxi = scpi->priv; Create_LinkParms link_parms; Create_LinkResp *link_resp; @@ -75,7 +76,7 @@ static int scpi_vxi_open(void *priv) link_parms.clientId = (long) vxi->client; link_parms.lockDevice = 0; link_parms.lock_timeout = VXI_DEFAULT_TIMEOUT_MS; - link_parms.device = "inst0"; + link_parms.device = (char *)"inst0"; if (!(link_resp = create_link_1(&link_parms, vxi->client))) { sr_err("Link creation failed for %s", vxi->address); @@ -118,7 +119,7 @@ static int scpi_vxi_send(void *priv, const char *command) Device_WriteResp *write_resp; Device_WriteParms write_parms; char *terminated_command; - unsigned int len; + unsigned long len; terminated_command = g_strdup_printf("%s\r\n", command); len = strlen(terminated_command); @@ -132,7 +133,7 @@ static int scpi_vxi_send(void *priv, const char *command) if (!(write_resp = device_write_1(&write_parms, vxi->client)) || write_resp->error) { - sr_err("Device write failed for %s with error %d", + sr_err("Device write failed for %s with error %ld", vxi->address, write_resp ? write_resp->error : 0); return SR_ERR; } @@ -140,7 +141,7 @@ static int scpi_vxi_send(void *priv, const char *command) g_free(terminated_command); if (write_resp->size < len) - sr_dbg("Only sent %d/%d bytes of SCPI command: '%s'.", + sr_dbg("Only sent %lu/%lu bytes of SCPI command: '%s'.", write_resp->size, len, command); else sr_spew("Successfully sent SCPI command: '%s'.", command); @@ -177,7 +178,7 @@ static int scpi_vxi_read_data(void *priv, char *buf, int maxlen) if (!(read_resp = device_read_1(&read_parms, vxi->client)) || read_resp->error) { - sr_err("Device read failed for %s with error %d", + sr_err("Device read failed for %s with error %ld", vxi->address, read_resp ? read_resp->error : 0); return SR_ERR; } @@ -194,9 +195,9 @@ static int scpi_vxi_read_complete(void *priv) return vxi->read_complete; } -static int scpi_vxi_close(void *priv) +static int scpi_vxi_close(struct sr_scpi_dev_inst *scpi) { - struct scpi_vxi *vxi = priv; + struct scpi_vxi *vxi = scpi->priv; Device_Error *dev_error; if (!vxi->client)