From: Zhang zhengguang <[email protected]> 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 <[email protected]> --- plugins/bluetooth.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c index 59e6dba..2c7e08a 100644 --- a/plugins/bluetooth.c +++ b/plugins/bluetooth.c @@ -605,13 +605,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) - 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) -- 1.7.9.5 _______________________________________________ connman mailing list [email protected] https://lists.connman.net/mailman/listinfo/connman
