From: Alexandru Gagniuc Date: Sat, 5 Mar 2016 19:33:56 +0000 (-0800) Subject: scpi/libgpib: Print error string instead of number on errors X-Git-Tag: libsigrok-0.5.0~535 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=daf13c570f3532a702401363a35195970600c046;p=libsigrok.git 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. --- 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; }