|
|
|
@ -9,6 +9,13 @@
@@ -9,6 +9,13 @@
|
|
|
|
|
#include <initguid.h> |
|
|
|
|
//#include "qextserialport.h"
|
|
|
|
|
#include <QRegExp> |
|
|
|
|
#ifdef Q_OS_WIN |
|
|
|
|
#ifndef _MSC_VER |
|
|
|
|
#include <windows.h> |
|
|
|
|
#include <dbt.h> |
|
|
|
|
#include <QtCore/qglobal.h> |
|
|
|
|
#endif |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
QextSerialEnumerator::QextSerialEnumerator( ) |
|
|
|
|
{ |
|
|
|
@ -193,12 +200,12 @@ bool QextSerialEnumerator::getDeviceDetailsWin( QextPortInfo* portInfo, HDEVINFO
@@ -193,12 +200,12 @@ bool QextSerialEnumerator::getDeviceDetailsWin( QextPortInfo* portInfo, HDEVINFO
|
|
|
|
|
QString hardwareIDs = getDeviceProperty(devInfo, devData, SPDRP_HARDWAREID); |
|
|
|
|
HKEY devKey = SetupDiOpenDevRegKey(devInfo, devData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ); |
|
|
|
|
|
|
|
|
|
QRegExp rx("^COM(\\d+)"); |
|
|
|
|
QString fullName(getRegKeyValue(devKey, TEXT("PortName"))); |
|
|
|
|
if(fullName.contains(rx)) { |
|
|
|
|
int portnum = rx.cap(1).toInt(); |
|
|
|
|
if(portnum > 9) // COM ports greater than 9 need \\.\ prepended
|
|
|
|
|
fullName.prepend("\\\\.\\"); |
|
|
|
|
QRegExp rx("^COM(\\d+)"); |
|
|
|
|
QString fullName(getRegKeyValue(devKey, TEXT("PortName"))); |
|
|
|
|
if(fullName.contains(rx)) { |
|
|
|
|
int portnum = rx.cap(1).toInt(); |
|
|
|
|
if(portnum > 9) // COM ports greater than 9 need \\.\ prepended
|
|
|
|
|
fullName.prepend("\\\\.\\"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
portInfo->portName = fullName; |
|
|
|
|