diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2013-04-30 23:07:53 +0400 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-30 21:48:55 +0200 |
commit | bcdeb589dd9d3b0ff7270d380d043b1882eefdc0 (patch) | |
tree | 5de942067d611cdeca2dfb8e6ec0ed3328058956 /src/serialport/qserialportinfo_win.cpp | |
parent | ce248225110bef2433bfcdbe8f462bf878dd63f7 (diff) | |
download | qtserialport-bcdeb589dd9d3b0ff7270d380d043b1882eefdc0.tar.gz |
Revert "Refactor the Windows port enumeration from GUID classes to devinterfaces"
This reverts commit 3bfe998860e0bfd3ce48784188eaa0d58bf86da1.
Patch with enumerating of devices through interfaces GUID's enters many
regressions, breaks universality and complicates realization.
For example, it breaks enumeration of CDC ACM devices. Moreover, some devices
(like Nokia phones) has incorrect registration in Windows registry so
workaround will greatly complicates code.
Decision with use of GUID's interfaces was worse than the previous with use of
setup GUID's. Thus, was made the decision to roll away changes on really
working decision with Setup Class GUID's.
Now tested for devices:
* built-in serial port
* USB/Serial converter on PL2303 chip
* USB/Serial converter on FTDI chip
* USB/Bluetooth dongle with standard MS bluetooth stack
* USB/CDMA Modem ZTE MF180
* Com0com virtual serial ports
* Eltima virtual serial ports
* Telit virtual serial ports
* CDC ACM serial port on Motorola E398 phone
* CDC ACM (and modem) serial port on Nokia E95 phone
on Windows XP/7/8.
Task-number: QTPLAYGROUND-27
Change-Id: Icc893e9e54e51dbf78da2d132dab6db986d94e03
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Diffstat (limited to 'src/serialport/qserialportinfo_win.cpp')
-rw-r--r-- | src/serialport/qserialportinfo_win.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/serialport/qserialportinfo_win.cpp b/src/serialport/qserialportinfo_win.cpp index 3299936..7ca1f5e 100644 --- a/src/serialport/qserialportinfo_win.cpp +++ b/src/serialport/qserialportinfo_win.cpp @@ -59,10 +59,16 @@ QT_BEGIN_NAMESPACE static const GUID guidsArray[] = { - // GUID_DEVINTERFACE_COMPORT - { 0x86E0D1E0, 0x8089, 0x11D0, { 0x9C, 0xE4, 0x08, 0x00, 0x3E, 0x30, 0x1F, 0x73} }, - // GUID_DEVINTERFACE_MODEM - { 0x2C7089AA, 0x2E0E, 0x11D1, { 0xB1, 0x14, 0x00, 0xC0, 0x4F, 0xC2, 0xAA, 0xE4} }, + // Windows Ports Class GUID + { 0x4D36E978, 0xE325, 0x11CE, { 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 } }, + // Virtual Ports Class GUID (i.e. com0com and etc) + { 0xDF799E12, 0x3C56, 0x421B, { 0xB2, 0x98, 0xB6, 0xD3, 0x64, 0x2B, 0xC8, 0x78 } }, + // Windows Modems Class GUID + { 0x4D36E96D, 0xE325, 0x11CE, { 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 } }, + // Eltima Virtual Serial Port Driver v4 GUID + { 0xCC0EF009, 0xB820, 0x42F4, { 0x95, 0xA9, 0x9B, 0xFA, 0x6A, 0x5A, 0xB7, 0xAB } }, + // Advanced Virtual COM Port GUID + { 0x9341CD95, 0x4371, 0x4A37, { 0xA5, 0xAF, 0xFD, 0xB0, 0xA9, 0xD1, 0x96, 0x31 } }, }; static QVariant deviceRegistryProperty(HDEVINFO deviceInfoSet, @@ -145,8 +151,7 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() static const int guidCount = sizeof(guidsArray)/sizeof(guidsArray[0]); for (int i = 0; i < guidCount; ++i) { - const HDEVINFO deviceInfoSet = ::SetupDiGetClassDevs(&guidsArray[i], NULL, 0, - DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); + const HDEVINFO deviceInfoSet = ::SetupDiGetClassDevs(&guidsArray[i], NULL, 0, DIGCF_PRESENT); if (deviceInfoSet == INVALID_HANDLE_VALUE) return serialPortInfoList; @@ -159,7 +164,7 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() QSerialPortInfo serialPortInfo; QString s = devicePortName(deviceInfoSet, &deviceInfoData); - if (s.isEmpty()) + if (s.isEmpty() || s.contains(QLatin1String("LPT"))) continue; serialPortInfo.d_ptr->portName = s; |