*/
#include <string.h>
-#include <errno.h>
#include "protocol.h"
/*
memset(packet, 0, PACKET_SIZE);
if ((ret = serial_read_nonblocking(serial, packet, PACKET_SIZE)) < 0) {
sr_err("Unable to read while probing for hardware: %s",
- strerror(errno));
+ sr_strerror(ret));
return NULL;
}
if (ret != PACKET_SIZE || packet[0] != 0xaa || packet[1] != 0xaa) {
*/
#include <ctype.h>
-#include <errno.h>
#include <math.h>
#include <string.h>
#include "protocol.h"
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;
}
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;
/* 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;
}
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;