Diff between 9e065d93547997bbfa9a18ea7bf99114c60b9d79 and 670d0ed2fd762b5ad2ea6d6a290404b7cd0e37d7

Changed Files

File Additions Deletions Status
emulator/bthost.c +18 -0 modified

Full Patch

diff --git a/emulator/bthost.c b/emulator/bthost.c
index 952faf3..ab055bb 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -552,15 +552,33 @@ static void evt_num_completed_packets(struct bthost *bthost, const void *data,
 		return;
 }
 
+static void evt_le_conn_complete(struct bthost *bthost, const void *data,
+								uint8_t len)
+{
+	const struct bt_hci_evt_le_conn_complete *ev = data;
+
+	if (len < sizeof(*ev))
+		return;
+
+	if (ev->status)
+		return;
+
+	init_conn(bthost, le16_to_cpu(ev->handle));
+}
+
 static void evt_le_meta_event(struct bthost *bthost, const void *data,
 								uint8_t len)
 {
 	const uint8_t *event = data;
+	const void *evt_data = data + 1;
 
 	if (len < 1)
 		return;
 
 	switch (*event) {
+	case BT_HCI_EVT_LE_CONN_COMPLETE:
+		evt_le_conn_complete(bthost, evt_data, len - 1);
+		break;
 	default:
 		break;
 	}