diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2009-02-12 14:30:15 -0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2009-02-12 14:30:15 -0300 |
commit | 7dfdd472eed6368bbae14aa989e712a49f3e7f12 (patch) | |
tree | d74b05929544f5a92478d8936755d7e0d7ac0221 | |
parent | d31f1f9fb937038e92e3c2228d3d4cda934cefa0 (diff) |
Fix resetting trusts on every reboot.
-rw-r--r-- | src/adapter.c | 6 | ||||
-rw-r--r-- | src/device.c | 24 | ||||
-rw-r--r-- | src/device.h | 2 |
3 files changed, 17 insertions, 15 deletions
diff --git a/src/adapter.c b/src/adapter.c index 02df6ea6..08993858 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -957,15 +957,9 @@ struct btd_device *adapter_create_device(DBusConnection *conn, void adapter_remove_device(DBusConnection *conn, struct btd_adapter *adapter, struct btd_device *device) { - bdaddr_t dst; const gchar *dev_path = device_get_path(device); struct agent *agent; - char dstaddr[18]; - - device_get_address(device, &dst); - ba2str(&dst, dstaddr); - delete_entry(&adapter->bdaddr, "profiles", dstaddr); adapter->devices = g_slist_remove(adapter->devices, device); adapter->connections = g_slist_remove(adapter->connections, device); diff --git a/src/device.c b/src/device.c index 50e8a5e8..f193ccfd 100644 --- a/src/device.c +++ b/src/device.c @@ -700,13 +700,24 @@ static void device_remove_bonding(struct btd_device *device, "Paired", DBUS_TYPE_BOOLEAN, &paired); } +static void device_remove_stored(struct btd_device *device, + DBusConnection *conn) +{ + bdaddr_t src; + char addr[18]; + + adapter_get_address(device->adapter, &src); + ba2str(&device->bdaddr, addr); + device_remove_bonding(device, conn); + delete_entry(&src, "profiles", addr); + delete_entry(&src, "trusts", addr); +} + void device_remove(struct btd_device *device, DBusConnection *conn, - gboolean remove_bonding) + gboolean remove_stored) { GSList *list; struct btd_device_driver *driver; - bdaddr_t src; - char addr[18]; gchar *path = g_strdup(device->path); debug("Removing device %s", path); @@ -714,8 +725,8 @@ void device_remove(struct btd_device *device, DBusConnection *conn, if (device->bonding) device_cancel_bonding(device, HCI_OE_USER_ENDED_CONNECTION); - if (!device->temporary && remove_bonding) - device_remove_bonding(device, conn); + if (!device->temporary && remove_stored) + device_remove_stored(device, conn); for (list = device->drivers; list; list = list->next) { struct btd_driver_data *driver_data = list->data; @@ -725,9 +736,6 @@ void device_remove(struct btd_device *device, DBusConnection *conn, g_free(driver_data); } - adapter_get_address(device->adapter, &src); - ba2str(&device->bdaddr, addr); - delete_entry(&src, "trusts", addr); g_dbus_unregister_interface(conn, path, DEVICE_INTERFACE); diff --git a/src/device.h b/src/device.h index 19112d20..c169c916 100644 --- a/src/device.h +++ b/src/device.h @@ -37,7 +37,7 @@ typedef enum { struct btd_device *device_create(DBusConnection *conn, struct btd_adapter *adapter, const gchar *address); void device_remove(struct btd_device *device, DBusConnection *conn, - gboolean remove_bonding); + gboolean remove_stored); gint device_address_cmp(struct btd_device *device, const gchar *address); int device_browse(struct btd_device *device, DBusConnection *conn, DBusMessage *msg, uuid_t *search, gboolean reverse); |