Skip to content

Commit

Permalink
bluetooth: Fix failure when enabling Bluez 5.x adapter
Browse files Browse the repository at this point in the history
Root cause:

When ConnMan tries to enable bluetooth technology, first 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. In current ConnMan Bluez 5.x
bluetooth plugin, 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.
  • Loading branch information
Zhang zhengguang authored and pfl committed Dec 17, 2013
1 parent 3bba8c7 commit df66c9c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions plugins/bluetooth.c
Expand Up @@ -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)
Expand Down

0 comments on commit df66c9c

Please sign in to comment.