diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-02 03:58:11 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-02 03:58:11 +0200 |
commit | 5b359e8460cdb69aef3b8a7292d4d325592a5d7d (patch) | |
tree | c805a615aed06012ece88a76cf640fb95397a940 /plugins | |
parent | d02f8cb0332c31af076efd812706d6301decd958 (diff) | |
download | bluez-5b359e8460cdb69aef3b8a7292d4d325592a5d7d.tar.gz |
mgmtops: Implement mgmt_cancel_bonding
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mgmtops.c | 15 |
1 files changed, 14 insertions, 1 deletions
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) |