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.
This commit is contained in:
Alexandru Gagniuc 2016-03-05 11:33:56 -08:00 committed by Uwe Hermann
parent 00b2a092c3
commit daf13c570f
1 changed files with 4 additions and 3 deletions

View File

@ -84,8 +84,8 @@ static int scpi_gpib_send(void *priv, const char *command)
if (ibsta & ERR) if (ibsta & ERR)
{ {
sr_err("Error while sending SCPI command: '%s': iberr = %d.", sr_err("Error while sending SCPI command: '%s': iberr = %s.",
command, iberr); command, gpib_error_string(iberr));
return SR_ERR; return SR_ERR;
} }
@ -118,7 +118,8 @@ static int scpi_gpib_read_data(void *priv, char *buf, int maxlen)
if (ibsta & ERR) 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; return SR_ERR;
} }