Diff between 391490491ac2508fab4341114fe5093686b4e2cd and 2d536dded7a8a68419fc84aa8050d984a6ae3dfe

Changed Files

File Additions Deletions Status
src/adapter.c +11 -1 modified
src/mgmt.c +0 -21 modified
src/mgmt.h +0 -2 modified

Full Patch

diff --git a/src/adapter.c b/src/adapter.c
index b14f122..73a503c 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 e7ea4be..d330848 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 653946d..1e6f980 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);