Diff between f89f6b68b8fddec39d049a2dbc32188cc6ea8cfc and 86c731b39b68c8c25bcf2f0222246c57bedc2d53

Changed Files

File Additions Deletions Status
plugins/mgmtops.c +12 -5 modified

Full Patch

diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 61d17ad..9ba7ccb 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -1670,15 +1670,22 @@ static int mgmt_set_limited_discoverable(int index, gboolean limited)
 
 static int mgmt_start_discovery(int index)
 {
-	struct mgmt_hdr hdr;
+	char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_start_discovery)];
+	struct mgmt_hdr *hdr = (void *) buf;
+	struct mgmt_cp_start_discovery *cp = (void *) &buf[sizeof(*hdr)];
 
 	DBG("index %d", index);
 
-	memset(&hdr, 0, sizeof(hdr));
-	hdr.opcode = htobs(MGMT_OP_START_DISCOVERY);
-	hdr.index = htobs(index);
+	memset(buf, 0, sizeof(buf));
+	hdr->opcode = htobs(MGMT_OP_START_DISCOVERY);
+	hdr->len = htobs(sizeof(*cp));
+	hdr->index = htobs(index);
 
-	if (write(mgmt_sock, &hdr, sizeof(hdr)) < 0)
+	hci_set_bit(MGMT_ADDR_BREDR, &cp->type);
+	hci_set_bit(MGMT_ADDR_LE_PUBLIC, &cp->type);
+	hci_set_bit(MGMT_ADDR_LE_RANDOM, &cp->type);
+
+	if (write(mgmt_sock, buf, sizeof(buf)) < 0)
 		return -errno;
 
 	return 0;