From 0903fa12a5e796d3e0eb95c1a45c42a96fad0d7a Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 13 Jan 2014 13:23:45 +0200 Subject: [PATCH] emulator/bthost: Add support for specifying custom IO capability --- emulator/bthost.c | 8 +++++++- emulator/bthost.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/emulator/bthost.c b/emulator/bthost.c index d18ca49d9..74b5df972 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -110,6 +110,7 @@ struct bthost { struct l2cap_pending_req *l2reqs; uint8_t pin[16]; uint8_t pin_len; + uint8_t io_capability; }; struct bthost *bthost_create(void) @@ -776,7 +777,7 @@ static void evt_io_cap_request(struct bthost *bthost, const void *data, return; memcpy(cp.bdaddr, ev->bdaddr, 6); - cp.capability = 0x03; + cp.capability = bthost->io_capability; cp.oob_data = 0x00; cp.authentication = 0x00; @@ -1503,6 +1504,11 @@ void bthost_set_pin_code(struct bthost *bthost, const uint8_t *pin, bthost->pin_len = pin_len; } +void bthost_set_io_capability(struct bthost *bthost, uint8_t io_capability) +{ + bthost->io_capability = io_capability; +} + void bthost_start(struct bthost *bthost) { if (!bthost) diff --git a/emulator/bthost.h b/emulator/bthost.h index 36b8c9216..a3ecb1a4c 100644 --- a/emulator/bthost.h +++ b/emulator/bthost.h @@ -84,6 +84,7 @@ void bthost_add_l2cap_server(struct bthost *bthost, uint16_t psm, void bthost_set_pin_code(struct bthost *bthost, const uint8_t *pin, uint8_t pin_len); +void bthost_set_io_capability(struct bthost *bthost, uint8_t io_capability); void bthost_start(struct bthost *bthost); void bthost_stop(struct bthost *bthost); -- 2.47.3