summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2013-03-26 15:39:56 +0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-29 16:19:55 +0100
commit84adad596c84f7e757d3305796ff715d8004f8e6 (patch)
treec3e79acb4a4582dad4fc71a68088fdc68e0b6804
parent733cbdf20779cec4ccafdd9d2068d44be2268033 (diff)
Mac: Fixed the description() method for Bluetooth devices
At the moment, the description() method returns empty string, because for Bluetooth devices does not exist the properties with the names kIOPropertyProductNameKey and kUSBProductString into dictionary. To obtain description information for the Bluetooth serial devices can to use a separate property called "BTName". This property can also be seen with the utility IORegistryExplorer. In the current implementation, the name "BTName" is hard-coded in the source code because I did not find any of its definition in the header files XCode, in the Apple's developer site and in general, on the hard drive. Thus, in the future it is possible to replace the hard-code to a constant, if it exists. Tested on MacOSX 10.6.8 Task-number: QTPLAYGROUND-25 Change-Id: I227aa2a1429660287ea83c1b142d2af3a11fd086 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r--src/serialport/qserialportinfo_mac.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/serialport/qserialportinfo_mac.cpp b/src/serialport/qserialportinfo_mac.cpp
index 44f26b57..1a751dfc 100644
--- a/src/serialport/qserialportinfo_mac.cpp
+++ b/src/serialport/qserialportinfo_mac.cpp
@@ -136,6 +136,14 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
CFSTR(kUSBProductString),
kCFAllocatorDefault,
0);
+ if (!description)
+ description =
+ ::IORegistryEntrySearchCFProperty(entry,
+ kIOServicePlane,
+ CFSTR("BTName"),
+ kCFAllocatorDefault,
+ 0);
+
if (description)
++matchingPropertiesCounter;
}