From d086d9565ab447722934ce750df95a45f649e4ba Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sat, 13 Sep 2014 05:51:00 +0300 Subject: [PATCH] emulator: Use explicit IO capability for bthost --- emulator/bthost.c | 5 ++++- emulator/bthost.h | 2 +- emulator/smp.c | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/emulator/bthost.c b/emulator/bthost.c index 1fd9ef99f..7f9af4313 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 d7d3d8a73..49a8649f4 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 32c82e556..5a6c558e5 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 */ -- 2.47.3