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>
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)