diff mbox series

[BlueZ,4/4] emulator: server: handle ISO, use BR/EDR+LE 5.2 by default

Message ID 20250609143811.566331-5-d3dx12.xx@gmail.com
State New
Headers show
Series btvirt improvements for LE Audio | expand

Commit Message

Dmitrii Sharshakov June 9, 2025, 2:38 p.m. UTC
Allow passing of ISO packets via the socket by parsing their header.

Set version to 5.2 to expose ISO/CIS and other LE Audio related
features when using server mode.
---
 emulator/server.c | 11 +++++++++--
 lib/hci.h         |  6 ++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/emulator/server.c b/emulator/server.c
index 0ca7d42a3..d86342601 100644
--- a/emulator/server.c
+++ b/emulator/server.c
@@ -118,6 +118,7 @@  again:
 	while (count > 0) {
 		hci_command_hdr *cmd_hdr;
 		hci_acl_hdr *acl_hdr;
+		hci_iso_hdr *iso_hdr;
 
 		if (!client->pkt_data) {
 			client->pkt_type = ptr[0];
@@ -140,8 +141,14 @@  again:
 				client->pkt_data = malloc(client->pkt_expect);
 				client->pkt_len = 0;
 				break;
+			case HCI_ISODATA_PKT:
+				iso_hdr = (hci_iso_hdr*)(ptr + 1);
+				client->pkt_expect = HCI_ISO_HDR_SIZE + iso_hdr->dlen + 1;
+				client->pkt_data = malloc(client->pkt_expect);
+				client->pkt_len = 0;
+				break;
 			default:
-				printf("packet error\n");
+				printf("packet error, unknown type: %d\n", client->pkt_type);
 				return;
 			}
 
@@ -218,7 +225,7 @@  static void server_accept_callback(int fd, uint32_t events, void *user_data)
 
 	switch (server->type) {
 	case SERVER_TYPE_BREDRLE:
-		type = BTDEV_TYPE_BREDRLE;
+		type = BTDEV_TYPE_BREDRLE52;
 		break;
 	case SERVER_TYPE_BREDR:
 		type = BTDEV_TYPE_BREDR;
diff --git a/lib/hci.h b/lib/hci.h
index c39a72cef..96733efc1 100644
--- a/lib/hci.h
+++ b/lib/hci.h
@@ -2311,6 +2311,12 @@  typedef struct {
 } __attribute__ ((packed))	hci_msg_hdr;
 #define HCI_MSG_HDR_SIZE	6
 
+typedef struct {
+	uint16_t	handle;
+	uint16_t	dlen;
+} __attribute__ ((packed))	hci_iso_hdr;
+#define HCI_ISO_HDR_SIZE	4
+
 /* Command opcode pack/unpack */
 #define cmd_opcode_pack(ogf, ocf)	(uint16_t)((ocf & 0x03ff)|(ogf << 10))
 #define cmd_opcode_ogf(op)		(op >> 10)