mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 19:54:57 +08:00
Add initialization params for serial port so that it can be read correctly without having to be initialized by another application.
This commit is contained in:
parent
827c4a784d
commit
cb7acae7c6
@ -70,7 +70,7 @@ Serial::SerialImpl::open ()
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_ATTRIBUTE_NORMAL, // FILE_FLAG_OVERLAPPED
|
||||||
0);
|
0);
|
||||||
|
|
||||||
if (fd_ == INVALID_HANDLE_VALUE) {
|
if (fd_ == INVALID_HANDLE_VALUE) {
|
||||||
@ -108,6 +108,20 @@ Serial::SerialImpl::reconfigurePort ()
|
|||||||
THROW (IOException, "Error getting the serial port state.");
|
THROW (IOException, "Error getting the serial port state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Boilerplate default settings
|
||||||
|
dcbSerialParams.fBinary = TRUE;
|
||||||
|
dcbSerialParams.fDtrControl = DTR_CONTROL_ENABLE;
|
||||||
|
dcbSerialParams.fDsrSensitivity = FALSE;
|
||||||
|
dcbSerialParams.fTXContinueOnXoff = FALSE;
|
||||||
|
dcbSerialParams.fOutX = FALSE;
|
||||||
|
dcbSerialParams.fInX = FALSE;
|
||||||
|
dcbSerialParams.fErrorChar = FALSE;
|
||||||
|
dcbSerialParams.fNull = FALSE;
|
||||||
|
dcbSerialParams.fRtsControl = RTS_CONTROL_ENABLE;
|
||||||
|
dcbSerialParams.fAbortOnError = FALSE;
|
||||||
|
dcbSerialParams.fOutxCtsFlow = FALSE;
|
||||||
|
dcbSerialParams.fOutxDsrFlow = FALSE;
|
||||||
|
|
||||||
// setup baud rate
|
// setup baud rate
|
||||||
switch (baudrate_) {
|
switch (baudrate_) {
|
||||||
#ifdef CBR_0
|
#ifdef CBR_0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user