From 5b359e8460cdb69aef3b8a7292d4d325592a5d7d Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 2 Feb 2012 03:58:11 +0200 Subject: [PATCH] mgmtops: Implement mgmt_cancel_bonding --- plugins/mgmtops.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c index 8f6788eaf..5c6ff29a3 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) -- 2.47.3