Fix bluetooth enable fail issue for bluez 5.x 77/12677/2 accepted/tizen/20131122.203502 submit/tizen/20131122.011455
authorZhang zhengguang <zhengguang.zhang@intel.com>
Thu, 21 Nov 2013 02:18:27 +0000 (10:18 +0800)
committerZhang zhengguang <zhengguang.zhang@intel.com>
Thu, 21 Nov 2013 05:50:30 +0000 (13:50 +0800)
Root cause:
When ConnMan tries to enable bluetooth technology, firstly
it will send RFkill unblock event to kernel, then call dbus method
to enable bluetooth device. When bluez receives the RFkill event,
it will power on the device immediately, and sends PropertyChanged
message to ConnMan. In ConnMan, the device powered state is updated in
device enable dbus reply callback function, but ConnMan receives
PropertyChanged message before device enable dbus reply, and in current
ConnMan bluetooth plugin for Bluez 5.x, when handling PropertyChanged
message, it finds the adapter state(enabled) is different with the device
state ConnMan stores(disabled), it will disable the bluetooth device.

Solution:
In ConnMan bluetooth plugin for Bluez 5.x, When ConnMan finds the adapter
state is different with the device state ConnMan stores, update device
state in ConnMan to the adapter state.

Change-Id: Iaba867daf228ce785d71b6e5358ec3f26ccac425
Signed-off-by: Zhang zhengguang <zhengguang.zhang@intel.com>
plugins/bluetooth.c

index b5e310e..8bbf2ad 100644 (file)
@@ -597,13 +597,8 @@ static void adapter_property_change(GDBusProxy *proxy, const char *name,
        DBG("device %p %s device powered %d adapter powered %d", device, path,
                        device_powered, adapter_powered);
 
-       if (device_powered != adapter_powered) {
-               DBG("powering adapter");
-               if (device_powered == TRUE)
-                       bluetooth_device_enable(device);
-               else
-                       bluetooth_device_disable(device);
-       }
+       if (device_powered != adapter_powered)
+               connman_device_set_powered(device, adapter_powered);
 }
 
 static void device_free(gpointer data)