#else
/* Returns the number of bytes read, or -1 upon failure. */
ret = read(serial->fd, buf, count);
- if (ret < 0)
- /*
- * Should be sr_err(), but that would yield lots of
- * "Resource temporarily unavailable" messages.
- */
- sr_spew("Read error: %s (fd %d).", strerror(errno), serial->fd);
- else
- sr_spew("Read %d/%d bytes (fd %d).", ret, count, serial->fd);
#endif
return ret;
speed = databits = parity = stopbits = 0;
rts = dtr = -1;
+ sr_spew("Parsing parameters from \"%s\".", paramstr);
reg = g_regex_new(SERIAL_COMM_SPEC, 0, 0, NULL);
if (g_regex_match(reg, paramstr, 0, &match)) {
if ((mstr = g_match_info_fetch(match, 1)))
g_match_info_unref(match);
g_regex_unref(reg);
- if (speed)
- return serial_set_params(serial, speed, databits, parity, stopbits,
- 0, rts, dtr);
- else
+ if (speed) {
+ return serial_set_params(serial, speed, databits, parity,
+ stopbits, 0, rts, dtr);
+ } else {
+ sr_dbg("Could not infer speed from parameter string.");
return SR_ERR_ARG;
+ }
}
/**
if (len > 0) {
ibuf += len;
} else if (len == 0) {
- sr_spew("Error: Only read 0 bytes.");
+ /* No logging, already done in serial_read(). */
} else {
/* Error reading byte, but continuing anyway. */
}