]> sigrok.org Git - libsigrok.git/commitdiff
serial.c: Be more verbose about failing to parse parameter string
authorAlexandru Gagniuc <redacted>
Sun, 2 Dec 2012 19:34:51 +0000 (13:34 -0600)
committerUwe Hermann <redacted>
Sun, 2 Dec 2012 21:22:07 +0000 (22:22 +0100)
Signed-off-by: Alexandru Gagniuc <redacted>
hardware/common/serial.c

index a18ad0b494073962f1bc7fb182b4e1c95db3b2e3..98b076109c0ffd2392fc1f5697c772cc67fdd108 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;
+       }
 }
 
 /**