diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 7dfae60..6c2e441 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
Command Code: 0x0014
Controller Index: <controller id>
Command Parameters: Address (6 Octets)
+ Address_Type (1 Octet)
IO_Capability (1 Octet)
Return Parameters: Address (6 Octets)
+ Address_Type (1 Octet)
Status (1 Octet)
+ Possible values for the Address_Type parameter:
+ 0 BR/EDR
+ 1 LE Public
+ 2 LE Random
+
User Confirmation Reply Command
===============================
diff --git a/lib/mgmt.h b/lib/mgmt.h
index 9eb6d2d..3960815 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
#define MGMT_OP_PAIR_DEVICE 0x0014
struct mgmt_cp_pair_device {
- bdaddr_t bdaddr;
+ struct mgmt_addr_info addr;
uint8_t io_cap;
} __packed;
struct mgmt_rp_pair_device {
- bdaddr_t bdaddr;
+ struct mgmt_addr_info addr;
uint8_t status;
} __packed;
diff --git a/mgmt/main.c b/mgmt/main.c
index e9b0ee1..573cfb3 100644
--- a/mgmt/main.c
+++ b/mgmt/main.c
exit(EXIT_FAILURE);
}
- ba2str(&rp->bdaddr, addr);
+ ba2str(&rp->addr.bdaddr, addr);
if (rp->status != 0) {
fprintf(stderr, "Pairing with %s failed with status %u\n",
static void pair_usage(void)
{
- printf("Usage: btmgmt pair [-c cap] <remote address>\n");
+ printf("Usage: btmgmt pair [-c cap] [-t type] <remote address>\n");
}
static struct option pair_options[] = {
{ "help", 0, 0, 'h' },
{ "capability", 1, 0, 'c' },
+ { "type", 1, 0, 't' },
{ 0, 0, 0, 0 }
};
{
struct mgmt_cp_pair_device cp;
uint8_t cap = 0x01;
+ uint8_t type = MGMT_ADDR_BREDR;
int opt;
- while ((opt = getopt_long(argc, argv, "+c:h", pair_options,
+ while ((opt = getopt_long(argc, argv, "+c:t:h", pair_options,
NULL)) != -1) {
switch (opt) {
case 'c':
cap = strtol(optarg, NULL, 0);
break;
-
+ case 't':
+ type = strtol(optarg, NULL, 0);
+ break;
case 'h':
default:
pair_usage();
index = 0;
memset(&cp, 0, sizeof(cp));
- str2ba(argv[0], &cp.bdaddr);
+ str2ba(argv[0], &cp.addr.bdaddr);
+ cp.addr.type = type;
cp.io_cap = cap;
if (mgmt_send_cmd(mgmt_sk, MGMT_OP_PAIR_DEVICE, index, &cp, sizeof(cp),
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 160bbd4..b9e9ad6 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
return;
}
- ba2str(&rp->bdaddr, addr);
+ ba2str(&rp->addr.bdaddr, addr);
DBG("hci%d %s pairing complete status %u", index, addr, rp->status);
info = &controllers[index];
- btd_event_bonding_complete(&info->bdaddr, &rp->bdaddr, rp->status);
+ btd_event_bonding_complete(&info->bdaddr, &rp->addr.bdaddr,
+ rp->status);
}
static void get_connections_complete(int sk, uint16_t index, void *buf,
hdr->len = htobs(sizeof(*cp));
hdr->index = htobs(index);
- bacpy(&cp->bdaddr, bdaddr);
+ bacpy(&cp->addr.bdaddr, bdaddr);
cp->io_cap = io_cap;
if (write(mgmt_sock, &buf, sizeof(buf)) < 0)