Handle the situation when the OS does not provide a baudrate in the code
path which opens the serial port. See bug #1632 and PR #6 for details.
https://sigrok.org/bugzilla/show_bug.cgi?id=1632
https://github.com/sigrokproject/libserialport/pull/6
This resolves bug #1632.
[ gsi: adjust comment style, rephrase comment and commit message ]
RETURN_CODEVAL(ret);
}
+ /*
+ * Assume a default baudrate if the OS does not provide one.
+ * Cannot assign -1 here since Windows holds the baudrate in
+ * the DCB and does not configure the rate individually.
+ */
+ if (config.baudrate == 0) {
+ config.baudrate = 9600;
+ }
+
/* Set sane port settings. */
#ifdef _WIN32
data.dcb.fBinary = TRUE;