mirror of
git://sigrok.org/libserialport
synced 2023-08-10 21:13:24 +03:00
Apply a default baudrate when the OS does not provide one.
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 ]
This commit is contained in:
parent
a06a765515
commit
1abec20502
@ -590,6 +590,15 @@ SP_API enum sp_return sp_open(struct sp_port *port, enum sp_mode flags)
|
|||||||
RETURN_CODEVAL(ret);
|
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. */
|
/* Set sane port settings. */
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
data.dcb.fBinary = TRUE;
|
data.dcb.fBinary = TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user