summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/serialport/qserialportinfo.cpp18
-rw-r--r--src/serialport/qserialportinfo.h4
-rw-r--r--src/serialport/qserialportinfo_mac.cpp6
-rw-r--r--src/serialport/qserialportinfo_p.h6
-rw-r--r--src/serialport/qserialportinfo_unix.cpp9
-rw-r--r--src/serialport/qserialportinfo_win.cpp4
6 files changed, 23 insertions, 24 deletions
diff --git a/src/serialport/qserialportinfo.cpp b/src/serialport/qserialportinfo.cpp
index 6d3ea334..e16e13e4 100644
--- a/src/serialport/qserialportinfo.cpp
+++ b/src/serialport/qserialportinfo.cpp
@@ -184,25 +184,23 @@ QString QSerialPortInfo::manufacturer() const
}
/*!
- Returns the vendor identifier string of the serial
- port in hexadecimal format, if available; otherwise
- returns an empty string.
+ Returns the 16-bit vendor number for the serial port, if available;
+ otherwise returns zero.
*/
-QString QSerialPortInfo::vendorIdentifier() const
+quint16 QSerialPortInfo::vendorIdentifier() const
{
Q_D(const QSerialPortInfo);
- return !d ? QString() : d->vendorIdentifier;
+ return !d ? 0 : d->vendorIdentifier;
}
/*!
- Returns the product identifier string of the serial
- port in hexadecimal format, if available; otherwise
- returns an empty string.
+ Returns the 16-bit product number for the serial port, if available;
+ otherwise returns zero.
*/
-QString QSerialPortInfo::productIdentifier() const
+quint16 QSerialPortInfo::productIdentifier() const
{
Q_D(const QSerialPortInfo);
- return !d ? QString() : d->productIdentifier;
+ return !d ? 0 : d->productIdentifier;
}
/*!
diff --git a/src/serialport/qserialportinfo.h b/src/serialport/qserialportinfo.h
index 96d48d78..19fd5b7e 100644
--- a/src/serialport/qserialportinfo.h
+++ b/src/serialport/qserialportinfo.h
@@ -71,8 +71,8 @@ public:
QString systemLocation() const;
QString description() const;
QString manufacturer() const;
- QString vendorIdentifier() const;
- QString productIdentifier() const;
+ quint16 vendorIdentifier() const;
+ quint16 productIdentifier() const;
bool isNull() const;
bool isBusy() const;
diff --git a/src/serialport/qserialportinfo_mac.cpp b/src/serialport/qserialportinfo_mac.cpp
index 0378f193..59cfad94 100644
--- a/src/serialport/qserialportinfo_mac.cpp
+++ b/src/serialport/qserialportinfo_mac.cpp
@@ -232,13 +232,13 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
::CFRelease(manufacturer);
}
- int value = 0;
+ quint16 value = 0;
if (vendorIdentifier) {
if (::CFNumberGetValue(CFNumberRef(vendorIdentifier),
kCFNumberIntType,
&value)) {
- serialPortInfo.d_ptr->vendorIdentifier = QString::number(value, 16);
+ serialPortInfo.d_ptr->vendorIdentifier = value;
}
::CFRelease(vendorIdentifier);
}
@@ -247,7 +247,7 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
if (::CFNumberGetValue(CFNumberRef(productIdentifier),
kCFNumberIntType,
&value)) {
- serialPortInfo.d_ptr->productIdentifier = QString::number(value, 16);
+ serialPortInfo.d_ptr->productIdentifier = value;
}
::CFRelease(productIdentifier);
}
diff --git a/src/serialport/qserialportinfo_p.h b/src/serialport/qserialportinfo_p.h
index 259752e3..ee7b8841 100644
--- a/src/serialport/qserialportinfo_p.h
+++ b/src/serialport/qserialportinfo_p.h
@@ -51,15 +51,15 @@ QT_BEGIN_NAMESPACE
class QSerialPortInfoPrivate
{
public:
- QSerialPortInfoPrivate() {}
+ QSerialPortInfoPrivate() : vendorIdentifier(0), productIdentifier(0) {}
~QSerialPortInfoPrivate() {}
QString portName;
QString device;
QString description;
QString manufacturer;
- QString vendorIdentifier;
- QString productIdentifier;
+ quint16 vendorIdentifier;
+ quint16 productIdentifier;
};
class QSerialPortInfoPrivateDeleter
diff --git a/src/serialport/qserialportinfo_unix.cpp b/src/serialport/qserialportinfo_unix.cpp
index c474e750..bfdc3d0c 100644
--- a/src/serialport/qserialportinfo_unix.cpp
+++ b/src/serialport/qserialportinfo_unix.cpp
@@ -145,12 +145,13 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
serialPortInfo.d_ptr->manufacturer = QString(
QLatin1String(::udev_device_get_property_value(dev,
"ID_VENDOR"))).replace('_', ' ');
+
serialPortInfo.d_ptr->vendorIdentifier =
- QLatin1String(::udev_device_get_property_value(dev,
- "ID_VENDOR_ID"));
+ QString::fromLatin1(::udev_device_get_property_value(dev, "ID_VENDOR_ID")).toInt(0, 16);
+
serialPortInfo.d_ptr->productIdentifier =
- QLatin1String(::udev_device_get_property_value(dev,
- "ID_MODEL_ID"));
+ QString::fromLatin1(::udev_device_get_property_value(dev, "ID_MODEL_ID")).toInt(0, 16);
+
} else if (subsys == QLatin1String("pnp")) { // PNP bus type
// Append this device.
// FIXME: How to get additional information about serial devices
diff --git a/src/serialport/qserialportinfo_win.cpp b/src/serialport/qserialportinfo_win.cpp
index 37880a70..0a6618e6 100644
--- a/src/serialport/qserialportinfo_win.cpp
+++ b/src/serialport/qserialportinfo_win.cpp
@@ -178,11 +178,11 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
int index = s.indexOf(vendorIdentifierPrefix);
if (index != -1)
- serialPortInfo.d_ptr->vendorIdentifier = s.mid(index + vendorIdentifierPrefix.size(), vendorIdentifierSize);
+ serialPortInfo.d_ptr->vendorIdentifier = s.mid(index + vendorIdentifierPrefix.size(), vendorIdentifierSize).toInt(0, 16);
index = s.indexOf(productIdentifierPrefix);
if (index != -1)
- serialPortInfo.d_ptr->productIdentifier = s.mid(index + productIdentifierPrefix.size(), productIdentifierSize);
+ serialPortInfo.d_ptr->productIdentifier = s.mid(index + productIdentifierPrefix.size(), productIdentifierSize).toInt(0, 16);
serialPortInfoList.append(serialPortInfo);
}