serial.c: Be more verbose about failing to parse parameter string

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
This commit is contained in:
Alexandru Gagniuc 2012-12-02 13:34:51 -06:00 committed by Uwe Hermann
parent 21829e6708
commit ea088bb693
1 changed files with 7 additions and 4 deletions

View 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;
}
}
/**