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>
commita93fc13093ce6c75f23f8edcf323a1244891f14b
parentf85c5fc1e25dd16dc625d15036d2dbc9498e8b76
authorDenis Shienkov <denis.shienkov@gmail.com>
committerThe Qt Project <gerrit-noreply@qt-project.org>
commit timeTue, 11 Feb 2014 08:16:42 +0100