summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/adapter.c6
-rw-r--r--src/device.c24
-rw-r--r--src/device.h2
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);