Diff between d02f8cb0332c31af076efd812706d6301decd958 and 5b359e8460cdb69aef3b8a7292d4d325592a5d7d

Changed Files

File Additions Deletions Status
plugins/mgmtops.c +14 -1 modified

Full Patch

diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 8f6788e..5c6ff29 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -1979,12 +1979,25 @@ static int mgmt_create_bonding(int index, bdaddr_t *bdaddr, uint8_t addr_type, u
 
 static int mgmt_cancel_bonding(int index, bdaddr_t *bdaddr)
 {
+	char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_addr_info)];
+	struct mgmt_hdr *hdr = (void *) buf;
+	struct mgmt_addr_info *cp = (void *) &buf[sizeof(*hdr)];
 	char addr[18];
 
 	ba2str(bdaddr, addr);
 	DBG("hci%d bdaddr %s", index, addr);
 
-	return -ENOSYS;
+	memset(buf, 0, sizeof(buf));
+	hdr->opcode = htobs(MGMT_OP_CANCEL_PAIR_DEVICE);
+	hdr->len = htobs(sizeof(*cp));
+	hdr->index = htobs(index);
+
+	bacpy(&cp->bdaddr, bdaddr);
+
+	if (write(mgmt_sock, &buf, sizeof(buf)) < 0)
+		return -errno;
+
+	return 0;
 }
 
 static int mgmt_read_local_oob_data(int index)