diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2014-01-28 16:22:33 +0400 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-11 08:16:42 +0100 |
commit | a93fc13093ce6c75f23f8edcf323a1244891f14b (patch) | |
tree | bd4876deac5fe396dc870294b3599dce8145a0ec /src/serialport/qserialport_wince.cpp | |
parent | f85c5fc1e25dd16dc625d15036d2dbc9498e8b76 (diff) |
Keep the DTR line state at changing of DCB properties
Updating of the DCB structure (in case of setup of some
properties through setXX() methods) leads to reset of a
status of the DTR line to an initial state.
For example, after opening of port the DTR state was "high",
further the call of method setDataTerminalReady(false)
will drop the DTR to "low" state. But if now to change any
properties of the device (e.g. to setup a new baud rate),
the DTR will again be set to "high".
The reason of this behavior is the fDtrControl flag of
DCB structure:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363214%28v=vs.85%29.aspx
To control of DTR is used the EscapeCommFunction() function
which has no relation to the DCB structure. Therefore any
re-initialization of the DCB discard the results of the
EscapeCommFunction() function in case a state of the
fDtrControl flag not equal to the real DTR state.
Solution is change of a fDtrControl flag after successfully
call of the EscapeCommFunction() function. Then further change
of any property will be with a correct DCB.
Besides, it is necessary to drop the flag DTR_CONTROL_HANDSHAKE
at opening of device. Because in this mode the manual control
of the DTR line is forbidden.
Thanks to Dr. Alexander W. Lenhardt
Task-number: QTBUG-36490
Change-Id: I14b040761f7e28108db87e667eb76f559be436cb
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src/serialport/qserialport_wince.cpp')
-rw-r--r-- | src/serialport/qserialport_wince.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/serialport/qserialport_wince.cpp b/src/serialport/qserialport_wince.cpp index d9116ccb..b987c802 100644 --- a/src/serialport/qserialport_wince.cpp +++ b/src/serialport/qserialport_wince.cpp @@ -204,6 +204,9 @@ bool QSerialPortPrivate::open(QIODevice::OpenMode mode) currentDcb.fNull = false; currentDcb.fErrorChar = false; + if (currentDcb.fDtrControl == DTR_CONTROL_HANDSHAKE) + currentDcb.fDtrControl = DTR_CONTROL_DISABLE; + if (!updateDcb()) return false; |