diff mbox series

[v2,05/11] emulator/bthost: Add support for LE CIS Request

Message ID 20201102191232.1848737-5-luiz.dentz@gmail.com
State New
Headers show
Series [v2,01/11] emulator/btdev: Add debug support | expand

Commit Message

Luiz Augusto von Dentz Nov. 2, 2020, 7:12 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This enables bthost to act as acceptor of LE CIS Request.
---
 emulator/bthost.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/emulator/bthost.c b/emulator/bthost.c
index f5b09bc4f..32676e179 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -1269,6 +1269,21 @@  static void evt_le_ltk_request(struct bthost *bthost, const void *data,
 								sizeof(cp));
 }
 
+static void evt_le_cis_req(struct bthost *bthost, const void *data, uint8_t len)
+{
+	const struct bt_hci_evt_le_cis_req *ev = data;
+	struct bt_hci_cmd_le_accept_cis cmd;
+
+	if (len < sizeof(*ev))
+		return;
+
+	memset(&cmd, 0, sizeof(cmd));
+
+	cmd.handle = ev->cis_handle;
+
+	send_command(bthost, BT_HCI_CMD_LE_ACCEPT_CIS, &cmd, sizeof(cmd));
+}
+
 static void evt_le_meta_event(struct bthost *bthost, const void *data,
 								uint8_t len)
 {
@@ -1297,6 +1312,9 @@  static void evt_le_meta_event(struct bthost *bthost, const void *data,
 	case BT_HCI_EVT_LE_ENHANCED_CONN_COMPLETE:
 		evt_le_ext_conn_complete(bthost, evt_data, len - 1);
 		break;
+	case BT_HCI_EVT_LE_CIS_REQ:
+		evt_le_cis_req(bthost, evt_data, len - 1);
+		break;
 	default:
 		util_debug(bthost->debug_callback, bthost->debug_data,
 				"Unsupported LE Meta event 0x%2.2x", *event);