From 84adad596c84f7e757d3305796ff715d8004f8e6 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Tue, 26 Mar 2013 15:39:56 +0400 Subject: 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 Reviewed-by: Denis Shienkov --- src/serialport/qserialportinfo_mac.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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::availablePorts() CFSTR(kUSBProductString), kCFAllocatorDefault, 0); + if (!description) + description = + ::IORegistryEntrySearchCFProperty(entry, + kIOServicePlane, + CFSTR("BTName"), + kCFAllocatorDefault, + 0); + if (description) ++matchingPropertiesCounter; } -- cgit v1.2.3