diff --git a/plugins/hciops.c b/plugins/hciops.c
index 1048bf6..f583e8c 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
/* Simple Pairing handling */
-static int hciops_confirm_reply(int index, bdaddr_t *bdaddr, gboolean success)
+static int hciops_confirm_reply(int index, bdaddr_t *bdaddr, addr_type_t type,
+ gboolean success)
{
struct dev_info *dev = &devs[index];
user_confirm_reply_cp cp;
/* Wait 5 milliseconds before doing auto-accept */
usleep(5000);
- if (hciops_confirm_reply(index, &req->bdaddr, TRUE) < 0)
+ if (hciops_confirm_reply(index, &req->bdaddr,
+ ADDR_TYPE_BREDR, TRUE) < 0)
goto fail;
return;
return err;
}
-static int hciops_passkey_reply(int index, bdaddr_t *bdaddr, uint32_t passkey)
+static int hciops_passkey_reply(int index, bdaddr_t *bdaddr, addr_type_t type,
+ uint32_t passkey)
{
struct dev_info *dev = &devs[index];
char addr[18];
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index c0af8d8..bcb23d5 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
}
}
-static int mgmt_confirm_reply(int index, bdaddr_t *bdaddr, gboolean success)
+static int mgmt_confirm_reply(int index, bdaddr_t *bdaddr, addr_type_t type,
+ gboolean success)
{
char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_user_confirm_reply)];
struct mgmt_hdr *hdr = (void *) buf;
cp = (void *) &buf[sizeof(*hdr)];
bacpy(&cp->addr.bdaddr, bdaddr);
+ cp->addr.type = mgmt_addr_type(type);
if (write(mgmt_sock, buf, sizeof(buf)) < 0)
return -errno;
return 0;
}
-static int mgmt_passkey_reply(int index, bdaddr_t *bdaddr, uint32_t passkey)
+static int mgmt_passkey_reply(int index, bdaddr_t *bdaddr, addr_type_t type,
+ uint32_t passkey)
{
char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_user_passkey_reply)];
struct mgmt_hdr *hdr = (void *) buf;
cp = (void *) &buf[sizeof(*hdr)];
bacpy(&cp->addr.bdaddr, bdaddr);
+ cp->addr.type = mgmt_addr_type(type);
buf_len = sizeof(*hdr) + sizeof(*cp);
} else {
cp = (void *) &buf[sizeof(*hdr)];
bacpy(&cp->addr.bdaddr, bdaddr);
+ cp->addr.type = mgmt_addr_type(type);
cp->passkey = htobl(passkey);
buf_len = sizeof(*hdr) + sizeof(*cp);
err = btd_event_user_passkey(&info->bdaddr, &ev->addr.bdaddr);
if (err < 0) {
error("btd_event_user_passkey: %s", strerror(-err));
- mgmt_passkey_reply(index, &ev->addr.bdaddr, INVALID_PASSKEY);
+ mgmt_passkey_reply(index, &ev->addr.bdaddr, ev->addr.type,
+ INVALID_PASSKEY);
}
}
struct confirm_data {
int index;
bdaddr_t bdaddr;
+ uint8_t type;
};
static gboolean confirm_accept(gpointer user_data)
if (data->index > max_index || !info->valid)
return FALSE;
- mgmt_confirm_reply(data->index, &data->bdaddr, TRUE);
+ mgmt_confirm_reply(data->index, &data->bdaddr, data->type, TRUE);
return FALSE;
}
data = g_new0(struct confirm_data, 1);
data->index = index;
bacpy(&data->bdaddr, &ev->addr.bdaddr);
+ data->type = ev->addr.type;
g_timeout_add_seconds_full(G_PRIORITY_DEFAULT, 1,
confirm_accept, data, g_free);
btohl(ev->value));
if (err < 0) {
error("btd_event_user_confirm: %s", strerror(-err));
- mgmt_confirm_reply(index, &ev->addr.bdaddr, FALSE);
+ mgmt_confirm_reply(index, &ev->addr.bdaddr, ev->addr.type,
+ FALSE);
}
}
diff --git a/src/adapter.c b/src/adapter.c
index 099b1c2..eb16c58 100644
--- a/src/adapter.c
+++ b/src/adapter.c
}
int btd_adapter_confirm_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
- gboolean success)
+ addr_type_t type, gboolean success)
{
- return adapter_ops->confirm_reply(adapter->dev_id, bdaddr, success);
+ return adapter_ops->confirm_reply(adapter->dev_id, bdaddr, type,
+ success);
}
int btd_adapter_passkey_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
- uint32_t passkey)
+ addr_type_t type, uint32_t passkey)
{
- return adapter_ops->passkey_reply(adapter->dev_id, bdaddr, passkey);
+ return adapter_ops->passkey_reply(adapter->dev_id, bdaddr, type,
+ passkey);
}
int btd_adapter_encrypt_link(struct btd_adapter *adapter, bdaddr_t *bdaddr,
diff --git a/src/adapter.h b/src/adapter.h
index f99eb19..946bac6 100644
--- a/src/adapter.h
+++ b/src/adapter.h
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 (*passkey_reply) (int index, bdaddr_t *bdaddr, uint32_t passkey);
+ int (*confirm_reply) (int index, bdaddr_t *bdaddr, addr_type_t type,
+ gboolean success);
+ int (*passkey_reply) (int index, bdaddr_t *bdaddr, addr_type_t type,
+ uint32_t passkey);
int (*encrypt_link) (int index, bdaddr_t *bdaddr, bt_hci_result_t cb,
gpointer user_data);
int (*set_did) (int index, uint16_t vendor, uint16_t product,
int btd_adapter_pincode_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
const char *pin, size_t pin_len);
int btd_adapter_confirm_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
- gboolean success);
+ addr_type_t type, gboolean success);
int btd_adapter_passkey_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
- uint32_t passkey);
+ addr_type_t type, uint32_t passkey);
int btd_adapter_encrypt_link(struct btd_adapter *adapter, bdaddr_t *bdaddr,
bt_hci_result_t cb, gpointer user_data);
diff --git a/src/event.c b/src/event.c
index ff1896a..136ad77 100644
--- a/src/event.c
+++ b/src/event.c
struct btd_device *device, gboolean success)
{
bdaddr_t bdaddr;
+ addr_type_t type;
- device_get_address(device, &bdaddr, NULL);
+ device_get_address(device, &bdaddr, &type);
- return btd_adapter_confirm_reply(adapter, &bdaddr, success);
+ return btd_adapter_confirm_reply(adapter, &bdaddr, type, success);
}
static void confirm_cb(struct agent *agent, DBusError *err, void *user_data)
struct btd_device *device = user_data;
struct btd_adapter *adapter = device_get_adapter(device);
bdaddr_t bdaddr;
+ addr_type_t type;
- device_get_address(device, &bdaddr, NULL);
+ device_get_address(device, &bdaddr, &type);
if (err)
passkey = INVALID_PASSKEY;
- btd_adapter_passkey_reply(adapter, &bdaddr, passkey);
+ btd_adapter_passkey_reply(adapter, &bdaddr, type, passkey);
}
int btd_event_user_confirm(bdaddr_t *sba, bdaddr_t *dba, uint32_t passkey)