diff mbox series

[BlueZ,2/6] btdev: send SCO setup events to bthost

Message ID f95f44e55cae99c6af1e1cd5219acbb45e145a22.1741288951.git.pav@iki.fi (mailing list archive)
State New
Headers show
Series [BlueZ,1/6] btdev: Add support for Sync Flow Control | expand

Checks

Context Check Description
tedd_an/pre-ci_am fail error: patch failed: emulator/btdev.c:1415 error: emulator/btdev.c: patch does not apply hint: Use 'git am --show-current-patch' to see the failed patch

Commit Message

Pauli Virtanen March 6, 2025, 7:23 p.m. UTC
Send required SCO setup events to bthost conns, so data can be passed to
the linked connection.
---
 emulator/btdev.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 51cb60a41..3542fdad5 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -1415,6 +1415,10 @@  done:
 
 	send_event(dev, BT_HCI_EVT_CONN_COMPLETE, &cc, sizeof(cc));
 
+	if (conn)
+		send_event(conn->link->dev, BT_HCI_EVT_CONN_COMPLETE,
+							&cc, sizeof(cc));
+
 	return 0;
 }
 
@@ -2824,6 +2828,10 @@  static int cmd_enhanced_setup_sync_conn_complete(struct btdev *dev,
 done:
 	send_event(dev, BT_HCI_EVT_SYNC_CONN_COMPLETE, &cc, sizeof(cc));
 
+	if (conn)
+		send_event(conn->link->dev, BT_HCI_EVT_SYNC_CONN_COMPLETE,
+							&cc, sizeof(cc));
+
 	return 0;
 }
 
@@ -2870,6 +2878,10 @@  static int cmd_setup_sync_conn_complete(struct btdev *dev, const void *data,
 done:
 	send_event(dev, BT_HCI_EVT_SYNC_CONN_COMPLETE, &cc, sizeof(cc));
 
+	if (conn)
+		send_event(conn->link->dev, BT_HCI_EVT_SYNC_CONN_COMPLETE,
+							&cc, sizeof(cc));
+
 	return 0;
 }
 
@@ -7674,7 +7686,7 @@  static void send_acl(struct btdev *dev, const void *data, uint16_t len)
 
 static void send_sco(struct btdev *dev, const void *data, uint16_t len)
 {
-	struct bt_hci_acl_hdr *hdr;
+	struct bt_hci_sco_hdr *hdr;
 	struct iovec iov[2];
 	struct btdev_conn *conn;
 	uint8_t pkt_type = BT_H4_SCO_PKT;
@@ -7694,7 +7706,8 @@  static void send_sco(struct btdev *dev, const void *data, uint16_t len)
 	if (dev->sco_flowctl)
 		num_completed_packets(dev, conn->handle);
 
-	send_packet(conn->link->dev, iov, 2);
+	if (conn->link)
+		send_packet(conn->link->dev, iov, 2);
 }
 
 static void send_iso(struct btdev *dev, const void *data, uint16_t len)