summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2015-07-02 17:51:03 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2015-07-08 13:25:40 +0000
commitfbe5c46ce311681b319f9cf277379958f3e10e93 (patch)
treed94f9ef5cc0fab2e844513325516b53c264cf1ec
parent3cd8cc12d9567288de77c0a5f44fe6c910b34af2 (diff)
downloadqtserialport-fbe5c46ce311681b319f9cf277379958f3e10e93.tar.gz
Fix opening of Exar VCP on Windows
The method QSPP::initialize() calls the GetCommState() function, which returns with the DCB.BaudRate field being 0. The subsequent call of SetCommState() would fail because of that. So, we need set DCB.BaudRate to any non-zero value (for example the input baud rate, which defaults to 9600) before calling the SetCommState() function. (cherry-picked from 1eaa42c99d8442a40718b8560903b0bfeb401a0e) Task-number: QTBUG-46993 Change-Id: I809246b13899733f9e0bd12b3667b23c0e43b00b Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r--src/serialport/qserialport_win.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp
index d189ba3..73fedc0 100644
--- a/src/serialport/qserialport_win.cpp
+++ b/src/serialport/qserialport_win.cpp
@@ -733,6 +733,8 @@ inline bool QSerialPortPrivate::initialize()
if (currentDcb.fDtrControl == DTR_CONTROL_HANDSHAKE)
currentDcb.fDtrControl = DTR_CONTROL_DISABLE;
+ currentDcb.BaudRate = inputBaudRate;
+
if (!updateDcb())
return false;