aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2009-04-08 13:41:50 +0300
committerJohan Hedberg <johan.hedberg@nokia.com>2009-04-08 13:41:50 +0300
commitd110b9c8fab968a49d7ec1d3831c46f18f50558c (patch)
tree64b404d30cb174c5faa961441cc4f669a71a495b /src
parent22911b0b33e1279567f2893aadf02f6bdf1d4e8b (diff)
downloadbluez-d110b9c8fab968a49d7ec1d3831c46f18f50558c.tar.gz
Fix Device.Connected property tracking when changing the Powered property.
The connected devices list wasn't properly cleared when setting Powered to off and so neither Connected=false nor Connected=true got emited when toggling the Powered state. This patch fixes this by calling adapter_remove_connection for each device in the adapter->connections list.
Diffstat (limited to 'src')
-rw-r--r--src/adapter.c6
-rw-r--r--src/device.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/adapter.c b/src/adapter.c
index 024de205..12dbf485 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2271,9 +2271,9 @@ int adapter_stop(struct btd_adapter *adapter)
adapter->oor_devices = NULL;
}
- if (adapter->connections) {
- g_slist_free(adapter->connections);
- adapter->connections = NULL;
+ while (adapter->connections) {
+ struct btd_device *device = adapter->connections->data;
+ adapter_remove_connection(adapter, device, 0);
}
if (adapter->scan_mode == (SCAN_PAGE | SCAN_INQUIRY)) {
diff --git a/src/device.c b/src/device.c
index 2ad0f443..ae0f63db 100644
--- a/src/device.c
+++ b/src/device.c
@@ -595,7 +595,7 @@ void device_add_connection(struct btd_device *device, DBusConnection *conn,
void device_remove_connection(struct btd_device *device, DBusConnection *conn,
uint16_t handle)
{
- if (device->handle != handle) {
+ if (handle && device->handle != handle) {
error("%s: Unable to remove connection %u, handle mismatch (%u)",
device->path, handle, device->handle);
return;