From 678b6733ef9b6d4118296670a5f97971434ec6a3 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 2 Jan 2014 12:32:16 +0200 Subject: [PATCH] emulator/bthost: Add support for encryption change HCI event --- emulator/bthost.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/emulator/bthost.c b/emulator/bthost.c index c627f8a8c..83bfdee55 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -70,6 +70,7 @@ struct cid_hook { struct btconn { uint16_t handle; uint8_t addr_type; + uint8_t encr_mode; uint16_t next_cid; struct l2conn *l2conns; struct cid_hook *cid_hooks; @@ -655,6 +656,24 @@ static void evt_num_completed_packets(struct bthost *bthost, const void *data, return; } +static void evt_encrypt_change(struct bthost *bthost, const void *data, + uint8_t len) +{ + const struct bt_hci_evt_encrypt_change *ev = data; + struct btconn *conn; + uint16_t handle; + + if (len < sizeof(*ev)) + return; + + handle = acl_handle(ev->handle); + conn = bthost_find_conn(bthost, handle); + if (!conn) + return; + + conn->encr_mode = ev->encr_mode; +} + static void evt_le_conn_complete(struct bthost *bthost, const void *data, uint8_t len) { @@ -731,6 +750,10 @@ static void process_evt(struct bthost *bthost, const void *data, uint16_t len) evt_num_completed_packets(bthost, param, hdr->plen); break; + case BT_HCI_EVT_ENCRYPT_CHANGE: + evt_encrypt_change(bthost, param, hdr->plen); + break; + case BT_HCI_EVT_LE_META_EVENT: evt_le_meta_event(bthost, param, hdr->plen); break; -- 2.47.3