From 8cc8080f43a884ea17c8f484463edd77f9a3567d Mon Sep 17 00:00:00 2001 From: Guido Trentalancia Date: Fri, 21 Dec 2018 21:29:39 +0100 Subject: [PATCH] Support parsing SCPI commands in sigrok-cli. The support for sending custom SCPI commands to the device has recently been added to libsigrok. Add the corresponding support for parsing such commands in sigrok-cli. Signed-off-by: Guido Trentalancia --- parsers.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- parsers.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/parsers.c b/parsers.c index 5ec655f..1cdd916 100644 --- a/parsers.c +++ b/parsers.c @@ -279,7 +279,12 @@ GHashTable *parse_generic_arg(const char *arg, gboolean sep_first) i = 0; hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - elements = g_strsplit(arg, ":", 0); + /* SCPI command syntax uses the ":" character */ + if (strncmp("command", arg, 7)) { + elements = g_strsplit(arg, ":", 0); + } else { + elements = g_strsplit(arg, "\n", 1); + } if (sep_first) g_hash_table_insert(hash, g_strdup("sigrok_key"), g_strdup(elements[i++]));