diff mbox series

[BlueZ,v1,3/3] bap: Mark device as connectable if a broadcast Endpoint is found

Message ID 20240125142936.3373953-3-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v1,1/3] btdev: Fix not clearing le_pa_sync_handle on reset | expand

Commit Message

Luiz Augusto von Dentz Jan. 25, 2024, 2:29 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If a broadcast Endpoint is found this uses btd_device_set_connectable to
make it as connectable since the Endpoint can be used to setup a
broadcast stream which requires the device object.
---
 profiles/audio/bap.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index a4036bbbdfa8..864761dfd919 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -1378,6 +1378,7 @@  static bool pac_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
 static bool pac_found_bcast(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
 							void *user_data)
 {
+	struct bap_data *data = user_data;
 	struct bap_ep *ep;
 
 	DBG("lpac %p rpac %p", lpac, rpac);
@@ -1388,6 +1389,9 @@  static bool pac_found_bcast(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
 		return true;
 	}
 
+	/* Mark the device as connetable if an Endpoint is registered */
+	btd_device_set_connectable(data->device, true);
+
 	return true;
 }
 
@@ -2456,6 +2460,8 @@  static void bap_bcast_remove(struct btd_service *service)
 		error("BAP service not handled by profile");
 		return;
 	}
+
+	bap_data_remove(data);
 }
 
 static int bap_probe(struct btd_service *service)