X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fscpi%2Fscpi_tcp.c;h=62974680aa93bdc99b321c5daeff5196af842134;hb=2c24077466a299ead689c90f01f55f6d86c7386b;hp=cf01c905cf65f8bfa4745275bbe820e15bbb0edc;hpb=7237e91262251a138cf150f9fcfe7b05d0e5904b;p=libsigrok.git diff --git a/src/scpi/scpi_tcp.c b/src/scpi/scpi_tcp.c index cf01c905..62974680 100644 --- a/src/scpi/scpi_tcp.c +++ b/src/scpi/scpi_tcp.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #ifdef _WIN32 #define _WIN32_WINNT 0x0501 #include @@ -71,9 +72,9 @@ static int scpi_tcp_dev_inst_new(void *priv, struct drv_context *drvc, return SR_OK; } -static int scpi_tcp_open(void *priv) +static int scpi_tcp_open(struct sr_scpi_dev_inst *scpi) { - struct scpi_tcp *tcp = priv; + struct scpi_tcp *tcp = scpi->priv; struct addrinfo hints; struct addrinfo *results, *res; int err; @@ -86,7 +87,7 @@ static int scpi_tcp_open(void *priv) err = getaddrinfo(tcp->address, tcp->port, &hints, &results); if (err) { - sr_err("Address lookup failed: %s:%d: %s", tcp->address, tcp->port, + sr_err("Address lookup failed: %s:%s: %s", tcp->address, tcp->port, gai_strerror(err)); return SR_ERR; } @@ -229,9 +230,9 @@ static int scpi_tcp_read_complete(void *priv) tcp->response_bytes_read >= tcp->response_length); } -static int scpi_tcp_close(void *priv) +static int scpi_tcp_close(struct sr_scpi_dev_inst *scpi) { - struct scpi_tcp *tcp = priv; + struct scpi_tcp *tcp = scpi->priv; if (close(tcp->socket) < 0) return SR_ERR;