From 2d536dded7a8a68419fc84aa8050d984a6ae3dfe Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sun, 6 Jan 2013 18:25:12 +0200 Subject: [PATCH] core: Move mgmt set IO capability command sending to adapter code --- src/adapter.c | 12 +++++++++++- src/mgmt.c | 21 --------------------- src/mgmt.h | 2 -- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/adapter.c b/src/adapter.c index b14f1221e..73a503c36 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -4075,7 +4075,17 @@ void adapter_bonding_complete(struct btd_adapter *adapter, int adapter_set_io_capability(struct btd_adapter *adapter, uint8_t io_cap) { - return mgmt_set_io_capability(adapter->dev_id, io_cap); + struct mgmt_cp_set_io_capability cp; + + memset(&cp, 0, sizeof(cp)); + cp.io_capability = io_cap; + + if (mgmt_send(adapter->mgmt, MGMT_OP_SET_IO_CAPABILITY, + adapter->dev_id, sizeof(cp), &cp, + NULL, NULL, NULL) > 0) + return 0; + + return -EIO; } int btd_adapter_read_local_oob_data(struct btd_adapter *adapter) diff --git a/src/mgmt.c b/src/mgmt.c index e7ea4be52..d3308484c 100644 --- a/src/mgmt.c +++ b/src/mgmt.c @@ -1139,27 +1139,6 @@ int mgmt_load_link_keys(int index, GSList *keys, gboolean debug_keys) return err; } -int mgmt_set_io_capability(int index, uint8_t io_capability) -{ - char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_set_io_capability)]; - struct mgmt_hdr *hdr = (void *) buf; - struct mgmt_cp_set_io_capability *cp = (void *) &buf[sizeof(*hdr)]; - - DBG("hci%d io_capability 0x%02x", index, io_capability); - - memset(buf, 0, sizeof(buf)); - hdr->opcode = htobs(MGMT_OP_SET_IO_CAPABILITY); - hdr->len = htobs(sizeof(*cp)); - hdr->index = htobs(index); - - cp->io_capability = io_capability; - - if (write(mgmt_sock, buf, sizeof(buf)) < 0) - return -errno; - - return 0; -} - int mgmt_create_bonding(int index, const bdaddr_t *bdaddr, uint8_t addr_type, uint8_t io_cap) { diff --git a/src/mgmt.h b/src/mgmt.h index 653946dc4..1e6f9806a 100644 --- a/src/mgmt.h +++ b/src/mgmt.h @@ -34,8 +34,6 @@ int mgmt_set_did(int index, uint16_t vendor, uint16_t product, int mgmt_load_link_keys(int index, GSList *keys, gboolean debug_keys); int mgmt_load_ltks(int index, GSList *keys); -int mgmt_set_io_capability(int index, uint8_t io_capability); - int mgmt_create_bonding(int index, const bdaddr_t *bdaddr, uint8_t addr_type, uint8_t io_cap); int mgmt_cancel_bonding(int index, const bdaddr_t *bdaddr, uint8_t addr_type); -- 2.47.3