Diff between 5a40cdff80f193a92fe07f9d38c9374849a8ee1a and d086d9565ab447722934ce750df95a45f649e4ba

Changed Files

File Additions Deletions Status
emulator/bthost.c +4 -1 modified
emulator/bthost.h +1 -1 modified
emulator/smp.c +2 -2 modified

Full Patch

diff --git a/emulator/bthost.c b/emulator/bthost.c
index 1fd9ef9..7f9af43 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -222,6 +222,9 @@ struct bthost *bthost_create(void)
 
 	memset(bthost, 0, sizeof(*bthost));
 
+	/* Set defaults */
+	bthost->io_capability = 0x03;
+
 	return bthost;
 }
 
@@ -2132,7 +2135,7 @@ void bthost_request_auth(struct bthost *bthost, uint16_t handle)
 		cp.handle = cpu_to_le16(handle);
 		send_command(bthost, BT_HCI_CMD_AUTH_REQUESTED, &cp, sizeof(cp));
 	} else {
-		smp_pair(conn->smp_data);
+		smp_pair(conn->smp_data, bthost->io_capability);
 	}
 }
 
diff --git a/emulator/bthost.h b/emulator/bthost.h
index d7d3d8a..49a8649 100644
--- a/emulator/bthost.h
+++ b/emulator/bthost.h
@@ -128,4 +128,4 @@ void *smp_conn_add(void *smp_data, uint16_t handle, const uint8_t *ia,
 void smp_conn_del(void *conn_data);
 void smp_data(void *conn_data, const void *data, uint16_t len);
 int smp_get_ltk(void *smp_data, uint64_t rand, uint16_t ediv, uint8_t *ltk);
-void smp_pair(void *conn_data);
+void smp_pair(void *conn_data, uint8_t io_cap);
diff --git a/emulator/smp.c b/emulator/smp.c
index 32c82e5..5a6c558 100644
--- a/emulator/smp.c
+++ b/emulator/smp.c
@@ -152,12 +152,12 @@ static void pairing_rnd(struct smp_conn *conn, const void *data, uint16_t len)
 	bthost_send_cid(bthost, conn->handle, SMP_CID, rsp, sizeof(rsp));
 }
 
-void smp_pair(void *conn_data)
+void smp_pair(void *conn_data, uint8_t io_cap)
 {
 	struct smp_conn *conn = conn_data;
 	struct bthost *bthost = conn->smp->bthost;
 	const uint8_t smp_pair_req[] = {	0x01,	/* Pairing Request */
-						0x03,	/* NoInputNoOutput */
+						io_cap,	/* IO Capability */
 						0x00,	/* OOB Flag */
 						0x01,	/* Bonding - no MITM */
 						0x10,	/* Max key size */