]> sigrok.org Git - libsigrok.git/commitdiff
scpi/libgpib: Print error string instead of number on errors
authorAlexandru Gagniuc <redacted>
Sat, 5 Mar 2016 19:33:56 +0000 (11:33 -0800)
committerUwe Hermann <redacted>
Wed, 30 Mar 2016 10:32:55 +0000 (12:32 +0200)
libgpib has an error_string which formats a numeric error code into a
human-readable description. Use that instead of printing the numeric
code, as it makes debugging easier.

src/scpi/scpi_libgpib.c

index 7632f74c9dc2ecf530986011ae02b08dd402f8cc..ed499cca5bad7bacd0e1e1fa07b70fc4ab7041a9 100644 (file)
@@ -84,8 +84,8 @@ static int scpi_gpib_send(void *priv, const char *command)
 
        if (ibsta & ERR)
        {
-               sr_err("Error while sending SCPI command: '%s': iberr = %d.",
-                               command, iberr);
+               sr_err("Error while sending SCPI command: '%s': iberr = %s.",
+                       command, gpib_error_string(iberr));
                return SR_ERR;
        }
 
@@ -118,7 +118,8 @@ static int scpi_gpib_read_data(void *priv, char *buf, int maxlen)
 
        if (ibsta & ERR)
        {
-               sr_err("Error while reading SCPI response: iberr = %d.", iberr);
+               sr_err("Error while reading SCPI response: iberr = %s.",
+                       gpib_error_string(iberr));
                return SR_ERR;
        }