]> sigrok.org Git - libsigrok.git/blobdiff - hardware/common/serial.c
fx2lafw: Use DRIVER_LOG_DOMAIN for log messages
[libsigrok.git] / hardware / common / serial.c
index a18ad0b494073962f1bc7fb182b4e1c95db3b2e3..cfdf9156a56556467d3755ce6f13cd3d7adfe02f 100644 (file)
@@ -655,6 +655,7 @@ SR_PRIV int serial_set_paramstr(struct sr_serial_dev_inst *serial,
 
        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)))
@@ -718,11 +719,13 @@ SR_PRIV int serial_set_paramstr(struct sr_serial_dev_inst *serial,
        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;
+       }
 }
 
 /**
@@ -831,7 +834,7 @@ SR_PRIV int serial_stream_detect(struct sr_serial_dev_inst *serial,
                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. */
                }