summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2015-03-14 00:48:53 +0400
committerDenis Shienkov <denis.shienkov@gmail.com>2015-03-14 18:58:06 +0000
commit85ec055cfec14370e088314eadb5fb0ad98a98f2 (patch)
treebd05d9d54adf60dbf1bea54782377abe955f7ab3 /src
parentef030b6d78c505ad42d3372bed83fc6091d6e257 (diff)
Fix QSPI::portName() on OSX
The commit ab51ad6a5f4e533c31bd8e5b6f16a3bcd09a3ee6 changes a behavior of conversion from a device location to a device name and vice-versa. Now it is expected that the location as "/dev/cu.serial1" will be converted to the "cu.serial1" name and vice-versa. But currently the QSPI on OSX returns the name of device as "serial1" instead of "cu.serial1", that lead to failure of QSP::open() method. The reason is that a device name is queried from the dictionary with the "kIOTTYDeviceKey" key, which always returns a right part of name from a dot. Thus, we need to use QSPI::portNameFromSystemLocation() method instead. (cherry-picked from 3db7c8ac2484c5e5eb10150b87a9c4d81d20b51d) Change-Id: Id7dfb2476c4a52a4c320c64588341fe6d0a5fa7d Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/serialport/qserialportinfo_mac.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/serialport/qserialportinfo_mac.cpp b/src/serialport/qserialportinfo_mac.cpp
index 51864893..a1e9e0ef 100644
--- a/src/serialport/qserialportinfo_mac.cpp
+++ b/src/serialport/qserialportinfo_mac.cpp
@@ -97,11 +97,6 @@ static bool isCompleteInfo(const QSerialPortInfoPrivate &priv)
&& priv.hasVendorIdentifier;
}
-static QString devicePortName(io_registry_entry_t ioRegistryEntry)
-{
- return searchStringProperty(ioRegistryEntry, QCFString(kIOTTYDeviceKey));
-}
-
static QString deviceSystemLocation(io_registry_entry_t ioRegistryEntry)
{
return searchStringProperty(ioRegistryEntry, QCFString(kIOCalloutDeviceKey));
@@ -171,11 +166,11 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
QSerialPortInfoPrivate priv;
forever {
- if (priv.portName.isEmpty())
- priv.portName = devicePortName(serialPortService);
-
- if (priv.device.isEmpty())
+ if (priv.device.isEmpty()) {
priv.device = deviceSystemLocation(serialPortService);
+ if (!priv.device.isEmpty())
+ priv.portName = QSerialPortInfoPrivate::portNameFromSystemLocation(priv.device);
+ }
if (priv.description.isEmpty())
priv.description = deviceDescription(serialPortService);