]> sigrok.org Git - libsigrok.git/blobdiff - src/scpi/scpi.c
spci: Terminate all commands with a linefeed for all transports
[libsigrok.git] / src / scpi / scpi.c
index fc7e9939c0e72ae5dfe173b25147ead17ffe5143..9f5dba43ae493a5b4558b1970186c07ddd69b417 100644 (file)
@@ -296,8 +296,10 @@ SR_PRIV int sr_scpi_send_variadic(struct sr_scpi_dev_inst *scpi,
        va_end(args_copy);
 
        /* Allocate buffer and write out command. */
-       buf = g_malloc(len + 1);
+       buf = g_malloc0(len + 2);
        vsprintf(buf, format, args);
+       if (buf[len - 1] != '\n')
+               buf[len] = '\n';
 
        /* Send command. */
        ret = scpi->send(scpi->priv, buf);