scpi_tcp: Adjust to observed protocol for Rigol VS5000 series.

This commit is contained in:
Martin Ling 2013-12-04 21:32:47 +00:00
parent 3520422fc7
commit b8705e99e4
1 changed files with 6 additions and 3 deletions

View File

@ -105,9 +105,12 @@ SR_PRIV int scpi_tcp_send(void *priv, const char *command)
{ {
struct scpi_tcp *tcp = priv; struct scpi_tcp *tcp = priv;
int len, out; int len, out;
char *terminated_command;
len = strlen(command); terminated_command = g_strdup_printf("%s\r\n", command);
out = send(tcp->socket, command, len, 0); len = strlen(terminated_command);
out = send(tcp->socket, terminated_command, len, 0);
g_free(terminated_command);
if (out < 0) { if (out < 0) {
sr_err("Send error: %s", strerror(errno)); 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; 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; *scpi_response = response->str;