From: Martin Ling Date: Wed, 4 Dec 2013 21:32:47 +0000 (+0000) Subject: scpi_tcp: Adjust to observed protocol for Rigol VS5000 series. X-Git-Tag: libsigrok-0.3.0~483 X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;h=b8705e99e45224941d43f10438d69726d8f2d85b;hp=3520422fc761d50830a45a43cd7d34cca589ad1b;p=libsigrok.git scpi_tcp: Adjust to observed protocol for Rigol VS5000 series. --- diff --git a/hardware/common/scpi_tcp.c b/hardware/common/scpi_tcp.c index d84c7e8f..35119243 100644 --- a/hardware/common/scpi_tcp.c +++ b/hardware/common/scpi_tcp.c @@ -105,9 +105,12 @@ SR_PRIV int scpi_tcp_send(void *priv, const char *command) { struct scpi_tcp *tcp = priv; int len, out; + char *terminated_command; - len = strlen(command); - out = send(tcp->socket, command, len, 0); + terminated_command = g_strdup_printf("%s\r\n", command); + len = strlen(terminated_command); + out = send(tcp->socket, terminated_command, len, 0); + g_free(terminated_command); if (out < 0) { sr_err("Send error: %s", strerror(errno)); @@ -141,7 +144,7 @@ SR_PRIV int scpi_tcp_receive(void *priv, char **scpi_response) return SR_ERR; } - response = g_string_append_len(response, buf, len); + response = g_string_append_len(response, buf + 4, len - 4); *scpi_response = response->str;