X-Git-Url: http://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=src%2Fhardware%2Fmotech-lps-30x%2Fapi.c;h=ba647837caf58079f32266b8e9d14d833df01997;hp=b9fee49d603d42a1f248cec6b84191fd0888c048;hb=8d5228015d0f07ce6626aa52ffb80bc4129f7dbe;hpb=6c7d80afcaf043eb8128a3102519032850fec1af diff --git a/src/hardware/motech-lps-30x/api.c b/src/hardware/motech-lps-30x/api.c index b9fee49d..ba647837 100644 --- a/src/hardware/motech-lps-30x/api.c +++ b/src/hardware/motech-lps-30x/api.c @@ -24,7 +24,6 @@ */ #include -#include #include #include #include "protocol.h" @@ -285,15 +284,16 @@ SR_PRIV int lps_process_status(struct sr_dev_inst* sdi, int stat) SR_PRIV int lps_query_status(struct sr_dev_inst* sdi) { char buf[LINELEN_MAX]; - int stat; + int stat, ret; struct dev_context* devc; devc = (struct dev_context*)sdi->priv; devc->req_sent_at = g_get_real_time(); - if (lps_cmd_reply(buf, sdi->conn, "STATUS") < 0) { - sr_err("%s: Failed to read status: %d %s", __func__, errno, strerror(errno)); + if ((ret = lps_cmd_reply(buf, sdi->conn, "STATUS")) < 0) { + sr_err("%s: Failed to read status: %s.", __func__, + sr_strerror(ret)); return SR_ERR; } @@ -379,7 +379,7 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o struct sr_channel_group *cg; GSList *devices; const char *conn, *serialcomm; - int cnt; + int cnt, ret; gchar buf[LINELEN_MAX]; gchar channel[10]; char *verstr; @@ -434,7 +434,7 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o /* Query version */ verstr = NULL; - if (lps_cmd_reply(buf, serial, "VERSION") == SR_OK) { + if ((ret = lps_cmd_reply(buf, serial, "VERSION")) == SR_OK) { if (strncmp(buf, "Ver-", 4)) { sr_spew("Version string %s not recognized.", buf); goto exit_err; @@ -445,7 +445,8 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o } else /* Bug in device FW 1.17: Querying version string fails while output is active. Therefore just print an error message, but do not exit with error. */ - sr_err("Failed to query for hardware version: %d %s", errno, strerror(errno)); + sr_err("Failed to query for hardware version: %s.", + sr_strerror(ret)); sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE;