X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fscpi%2Fscpi_vxi.c;h=c1329088b294b2ff0d46a7c49121205b8c163f8c;hb=83c1dbd9b547edc3f0aec80d7427b14672654d4a;hp=e4efbf1d1d55cab2f55eb4cf91b638a66cc6ed4a;hpb=1a46cc62e2b528bcaeb1f8dc0c952a81b3bcba5c;p=libsigrok.git diff --git a/src/scpi/scpi_vxi.c b/src/scpi/scpi_vxi.c index e4efbf1d..c1329088 100644 --- a/src/scpi/scpi_vxi.c +++ b/src/scpi/scpi_vxi.c @@ -20,12 +20,13 @@ * along with this program. If not, see . */ +#include +#include "vxi.h" #include #include - -#include "vxi.h" -#include "libsigrok.h" +#include #include "libsigrok-internal.h" +#include "scpi.h" #define LOG_PREFIX "scpi_vxi" #define VXI_DEFAULT_TIMEOUT_MS 2000 @@ -66,7 +67,7 @@ static int scpi_vxi_open(void *priv) Create_LinkResp *link_resp; vxi->client = clnt_create(vxi->address, DEVICE_CORE, DEVICE_CORE_VERSION, "tcp"); - if (vxi->client == NULL) { + if (!vxi->client) { sr_err("Client creation failed for %s", vxi->address); return SR_ERR; } @@ -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; }