diff mbox series

[BlueZ,5/5] media: Fix not checking BREDR support for A2DP

Message ID 20230301013842.718438-5-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit 15458c5e1071fa9fa23c373e3330ff45d1792e3f
Headers show
Series [BlueZ,1/5] device: Don't attempt to connect LE if ATT is already connected | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Luiz Augusto von Dentz March 1, 2023, 1:38 a.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

A2DP shall depend on MGMT_SETTING_BREDR setting so the likes of
bluetoothctl -e don't attempt to register A2DP with controller that
are on LE only mode.
---
 profiles/audio/media.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 326e50a0925b..540e91bc6706 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1269,8 +1269,11 @@  static bool endpoint_properties_get(const char *uuid,
 	return true;
 }
 
-static bool endpoint_supported(struct btd_adapter *adapter)
+static bool a2dp_endpoint_supported(struct btd_adapter *adapter)
 {
+	if (!btd_adapter_has_settings(adapter, MGMT_SETTING_BREDR))
+		return false;
+
 	return true;
 }
 
@@ -1291,8 +1294,10 @@  static struct media_endpoint_init {
 	bool (*func)(struct media_endpoint *endpoint, int *err);
 	bool (*supported)(struct btd_adapter *adapter);
 } init_table[] = {
-	{ A2DP_SOURCE_UUID, endpoint_init_a2dp_source, endpoint_supported },
-	{ A2DP_SINK_UUID, endpoint_init_a2dp_sink, endpoint_supported },
+	{ A2DP_SOURCE_UUID, endpoint_init_a2dp_source,
+				a2dp_endpoint_supported },
+	{ A2DP_SINK_UUID, endpoint_init_a2dp_sink,
+				a2dp_endpoint_supported },
 	{ PAC_SINK_UUID, endpoint_init_pac_sink,
 				experimental_endpoint_supported },
 	{ PAC_SOURCE_UUID, endpoint_init_pac_source,