diff --git a/plugins/hciops.c b/plugins/hciops.c
index 90106df..c51ddcf 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
return disconnect_addr(index, bdaddr, HCI_OE_USER_ENDED_CONNECTION);
}
-static int hciops_remove_bonding(int index, bdaddr_t *bdaddr)
+static int hciops_remove_bonding(int index, bdaddr_t *bdaddr, addr_type_t type)
{
struct dev_info *dev = &devs[index];
delete_stored_link_key_cp cp;
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 519e34c..a2df3f7 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
bonding_complete(info, &ev->key.bdaddr, 0);
}
-static inline addr_type_t mgmt_addr_type(uint8_t mgmt_addr_type)
+static inline addr_type_t addr_type(uint8_t mgmt_addr_type)
{
switch (mgmt_addr_type) {
case MGMT_ADDR_BREDR:
}
}
+static inline uint8_t mgmt_addr_type(addr_type_t addr_type)
+{
+ switch (addr_type) {
+ case ADDR_TYPE_BREDR:
+ return MGMT_ADDR_BREDR;
+ case ADDR_TYPE_LE_PUBLIC:
+ return MGMT_ADDR_LE_PUBLIC;
+ case ADDR_TYPE_LE_RANDOM:
+ return MGMT_ADDR_LE_RANDOM;
+ default:
+ return MGMT_ADDR_BREDR;
+ }
+}
+
static void mgmt_device_connected(int sk, uint16_t index, void *buf, size_t len)
{
struct mgmt_ev_device_connected *ev = buf;
eir_parse(&eir_data, ev->eir, eir_len);
btd_event_conn_complete(&info->bdaddr, &ev->addr.bdaddr,
- mgmt_addr_type(ev->addr.type),
- eir_data.name, eir_data.dev_class);
+ addr_type(ev->addr.type),
+ eir_data.name,
+ eir_data.dev_class);
eir_data_free(&eir_data);
}
ev->confirm_name, eir_len);
btd_event_device_found(&info->bdaddr, &ev->addr.bdaddr,
- mgmt_addr_type(ev->addr.type),
+ addr_type(ev->addr.type),
ev->rssi, ev->confirm_name,
eir, eir_len);
}
return 0;
}
-static int mgmt_unpair_device(int index, bdaddr_t *bdaddr)
+static int mgmt_unpair_device(int index, bdaddr_t *bdaddr, addr_type_t type)
{
char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_unpair_device)];
struct mgmt_hdr *hdr = (void *) buf;
hdr->index = htobs(index);
bacpy(&cp->addr.bdaddr, bdaddr);
+ cp->addr.type = mgmt_addr_type(type);
cp->disconnect = 1;
if (write(mgmt_sock, buf, sizeof(buf)) < 0)
diff --git a/src/adapter.c b/src/adapter.c
index 89f6ca7..e7c71b0 100644
--- a/src/adapter.c
+++ b/src/adapter.c
return adapter_ops->disconnect(adapter->dev_id, bdaddr);
}
-int btd_adapter_remove_bonding(struct btd_adapter *adapter, bdaddr_t *bdaddr)
+int btd_adapter_remove_bonding(struct btd_adapter *adapter, bdaddr_t *bdaddr,
+ addr_type_t type)
{
- return adapter_ops->remove_bonding(adapter->dev_id, bdaddr);
+ return adapter_ops->remove_bonding(adapter->dev_id, bdaddr, type);
}
int btd_adapter_pincode_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
diff --git a/src/adapter.h b/src/adapter.h
index 7265d8b..f83e412 100644
--- a/src/adapter.h
+++ b/src/adapter.h
int (*unblock_device) (int index, bdaddr_t *bdaddr);
int (*get_conn_list) (int index, GSList **conns);
int (*disconnect) (int index, bdaddr_t *bdaddr);
- int (*remove_bonding) (int index, bdaddr_t *bdaddr);
+ int (*remove_bonding) (int index, bdaddr_t *bdaddr, addr_type_t type);
int (*pincode_reply) (int index, bdaddr_t *bdaddr, const char *pin,
size_t pin_len);
int (*confirm_reply) (int index, bdaddr_t *bdaddr, gboolean success);
int btd_adapter_disconnect_device(struct btd_adapter *adapter,
bdaddr_t *bdaddr);
-int btd_adapter_remove_bonding(struct btd_adapter *adapter, bdaddr_t *bdaddr);
+int btd_adapter_remove_bonding(struct btd_adapter *adapter, bdaddr_t *bdaddr,
+ addr_type_t type);
int btd_adapter_pincode_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
const char *pin, size_t pin_len);
diff --git a/src/device.c b/src/device.c
index ac2a93c..c91e321 100644
--- a/src/device.c
+++ b/src/device.c
delete_entry(&src, "longtermkeys", addr);
device_set_bonded(device, FALSE);
device->paired = FALSE;
- btd_adapter_remove_bonding(device->adapter, &device->bdaddr);
+ btd_adapter_remove_bonding(device->adapter, &device->bdaddr,
+ device->type);
}
delete_entry(&src, "profiles", addr);
delete_entry(&src, "trusts", addr);
return;
if (!value)
- btd_adapter_remove_bonding(device->adapter, &device->bdaddr);
+ btd_adapter_remove_bonding(device->adapter, &device->bdaddr,
+ device->type);
device->paired = value;