From daf13c570f3532a702401363a35195970600c046 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Sat, 5 Mar 2016 11:33:56 -0800 Subject: [PATCH] scpi/libgpib: Print error string instead of number on errors 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/scpi/scpi_libgpib.c b/src/scpi/scpi_libgpib.c index 7632f74c..ed499cca 100644 --- a/src/scpi/scpi_libgpib.c +++ b/src/scpi/scpi_libgpib.c @@ -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; }