summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothlocaldevice_osx.mm
diff options
context:
space:
mode:
authorTimur Pocheptsov <Timur.Pocheptsov@digia.com>2014-12-01 15:00:49 +0100
committerTimur Pocheptsov <Timur.Pocheptsov@digia.com>2014-12-01 16:16:40 +0100
commit78d90f1ec64fc7d588346c26d4270dc58c395e54 (patch)
tree606550f35b074864d2f0d32981e9204071520382 /src/bluetooth/qbluetoothlocaldevice_osx.mm
parent913de211b3971d03e1e12bf31a5bbd7fd366952f (diff)
QBluetoothLocalDevice - bug on OS X (isValid)
If BT adapter is off local device is invalid on OS X: no way to access information like address/name, no way to turn the device on, all operations fail. Considering it's valid breaks the logic: you can pass any address to such a device (invalid non-null address) and device can not check if it's valid or not. Change-Id: I25f70723d566d4de8f993fc9c9a9e6867f936b7f Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/qbluetoothlocaldevice_osx.mm')
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_osx.mm6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_osx.mm b/src/bluetooth/qbluetoothlocaldevice_osx.mm
index 38f15b8c..7e5cb12a 100644
--- a/src/bluetooth/qbluetoothlocaldevice_osx.mm
+++ b/src/bluetooth/qbluetoothlocaldevice_osx.mm
@@ -120,7 +120,11 @@ QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(QBluetoothLocalDevice
QT_BT_MAC_AUTORELEASEPOOL;
HostController defaultController([[IOBluetoothHostController defaultController] retain]);
- if (!defaultController) {
+ if (!defaultController || [defaultController powerState] != kBluetoothHCIPowerStateON) {
+ // IOBluetooth can return non-null host controller without working adapter.
+ // Unfortunately, a local device in such a state is totally useless:
+ // you can not access any information like address/name or change the device
+ // state to powered on. So it's not valid.
qCCritical(QT_BT_OSX) << "QBluetoothLocalDevicePrivate(), failed to "
"init a host controller object";
return;