public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bluez v1] transport/audio: fix build with a2dp support disabled
@ 2025-11-22 16:10 Peter Seiderer
  2025-11-22 17:03 ` [bluez,v1] " bluez.test.bot
  2025-11-25 16:30 ` [PATCH bluez v1] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Seiderer @ 2025-11-22 16:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Peter Seiderer

Fixes:
    CCLD     src/bluetoothd
  /usr/lib64/gcc/x86_64-suse-linux/bin/ld: profiles/audio/bluetoothd-media.o: in function `endpoint_init_a2dp_sink':
  .../bluez-5.85/profiles/audio/media.c:728:(.text.endpoint_init_a2dp_sink+0x2b): undefined reference to `a2dp_add_sep'
  /usr/lib64/gcc/x86_64-suse-linux/bin/ld: profiles/audio/bluetoothd-media.o: in function `endpoint_init_a2dp_source':
  .../bluez-5.85/profiles/audio/media.c:715:(.text.endpoint_init_a2dp_source+0x28): undefined reference to `a2dp_add_sep'
  /usr/lib64/gcc/x86_64-suse-linux/bin/ld: profiles/audio/bluetoothd-media.o: in function `set_configuration':
  .../bluez-5.85/profiles/audio/media.c:512:(.text.set_config+0x35): undefined reference to `a2dp_setup_get_device'
  /usr/lib64/gcc/x86_64-suse-linux/bin/ld: .../bluez-5.85/profiles/audio/media.c:525:(.text.set_config+0x8c): undefined reference to `a2dp_setup_remote_path'
  /usr/lib64/gcc/x86_64-suse-linux/bin/ld: profiles/audio/bluetoothd-media.o: in function `media_endpoint_remove':
  .../bluez-5.85/profiles/audio/media.c:250:(.text.media_endpoint_remove+0xc): undefined reference to `a2dp_remove_sep'
  /usr/lib64/gcc/x86_64-suse-linux/bin/ld: profiles/audio/bluetoothd-media.o: in function `endpoint_reply':
  .../bluez-5.85/profiles/audio/media.c:361:(.text.endpoint_reply+0x267): undefined reference to `a2dp_parse_config_error'
  collect2: error: ld returned 1 exit status
  make[1]: *** [Makefile:5491: src/bluetoothd] Error 1
  make: *** [Makefile:4096: all] Error 2

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Notes:
 - patch inspired by 61d3e44 ("transport: Fix build with A2DP support disabled")
   compile tested only
 -  specially the part in media.c around line 365 to 374
    (a2dp_parse_config_error) is a wild guess
 - handle with care ;-)
---
 profiles/audio/media.c     | 19 ++++++++++++++++++-
 profiles/audio/transport.c |  6 ++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index a7a8575f9..418a9d06b 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -56,14 +56,18 @@
 #include "src/shared/bap.h"
 #include "src/shared/bap-debug.h"
 
+#ifdef HAVE_A2DP
 #include "avdtp.h"
+#endif
 #include "media.h"
 #include "transport.h"
+#ifdef HAVE_A2DP
 #include "a2dp.h"
 
 #ifdef HAVE_AVRCP
 #include "avrcp.h"
 #endif
+#endif
 
 #define MEDIA_INTERFACE "org.bluez.Media1"
 #define MEDIA_ENDPOINT_INTERFACE "org.bluez.MediaEndpoint1"
@@ -106,7 +110,9 @@ struct endpoint_request {
 };
 
 struct media_endpoint {
+#ifdef HAVE_A2DP
 	struct a2dp_sep		*sep;
+#endif
 	struct bt_bap_pac	*pac;
 	struct bt_asha_device	*asha;
 	char			*sender;	/* Endpoint DBus bus id */
@@ -246,10 +252,12 @@ static void media_endpoint_remove(void *data)
 	struct media_endpoint *endpoint = data;
 	struct media_adapter *adapter = endpoint->adapter;
 
+#ifdef HAVE_A2DP
 	if (endpoint->sep) {
 		a2dp_remove_sep(endpoint->sep);
 		return;
 	}
+#endif
 
 	info("Endpoint unregistered: sender=%s path=%s", endpoint->sender,
 			endpoint->path);
@@ -354,6 +362,7 @@ static void endpoint_reply(DBusPendingCall *call, void *user_data)
 			return;
 		}
 
+#ifdef HAVE_A2DP
 		if (dbus_message_is_method_call(request->msg,
 					MEDIA_ENDPOINT_INTERFACE,
 					"SetConfiguration")) {
@@ -362,7 +371,7 @@ static void endpoint_reply(DBusPendingCall *call, void *user_data)
 			ret = &error_code;
 			size = 1;
 		}
-
+#endif
 		dbus_error_free(&err);
 		goto done;
 	}
@@ -497,6 +506,7 @@ static struct media_transport *find_device_transport(
 	return match->data;
 }
 
+#ifdef HAVE_A2DP
 struct a2dp_config_data {
 	struct a2dp_setup *setup;
 	a2dp_endpoint_config_t cb;
@@ -552,6 +562,7 @@ static gboolean set_configuration(struct media_endpoint *endpoint,
 	return media_endpoint_async_call(msg, endpoint, transport,
 						cb, user_data, destroy);
 }
+#endif
 
 static void release_endpoint(struct media_endpoint *endpoint)
 {
@@ -602,6 +613,7 @@ static size_t get_capabilities(struct a2dp_sep *sep, uint8_t **capabilities,
 	return endpoint->size;
 }
 
+#ifdef HAVE_A2DP
 struct a2dp_select_data {
 	struct a2dp_setup *setup;
 	a2dp_endpoint_select_t cb;
@@ -735,6 +747,7 @@ static bool endpoint_init_a2dp_sink(struct media_endpoint *endpoint, int *err)
 
 	return true;
 }
+#endif
 
 struct pac_select_data {
 	struct bt_bap_pac *pac;
@@ -1486,10 +1499,12 @@ static const struct media_endpoint_init {
 	bool (*func)(struct media_endpoint *endpoint, int *err);
 	bool (*supported)(struct btd_adapter *adapter);
 } init_table[] = {
+#ifdef HAVE_A2DP
 	{ A2DP_SOURCE_UUID, endpoint_init_a2dp_source,
 				a2dp_endpoint_supported },
 	{ A2DP_SINK_UUID, endpoint_init_a2dp_sink,
 				a2dp_endpoint_supported },
+#endif
 	{ PAC_SINK_UUID, endpoint_init_pac_sink,
 				experimental_endpoint_supported },
 	{ PAC_SOURCE_UUID, endpoint_init_pac_source,
@@ -3478,10 +3493,12 @@ void media_unregister(struct btd_adapter *btd_adapter)
 	}
 }
 
+#ifdef HAVE_A2DP
 struct a2dp_sep *media_endpoint_get_sep(struct media_endpoint *endpoint)
 {
 	return endpoint->sep;
 }
+#endif
 
 const char *media_endpoint_get_uuid(struct media_endpoint *endpoint)
 {
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index 08ca360f4..fc23cf33d 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -2745,6 +2745,7 @@ void media_transport_update_volume(struct media_transport *transport,
 	if (volume < 0)
 		return;
 
+#ifdef HAVE_A2DP
 	if (media_endpoint_get_sep(transport->endpoint)) {
 		struct a2dp_transport *a2dp = transport->data;
 
@@ -2757,6 +2758,7 @@ void media_transport_update_volume(struct media_transport *transport,
 
 		a2dp->volume = volume;
 	}
+#endif
 	g_dbus_emit_property_changed(btd_get_dbus_connection(),
 					transport->path,
 					MEDIA_TRANSPORT_INTERFACE, "Volume");
@@ -2769,6 +2771,7 @@ int media_transport_get_device_volume(struct btd_device *dev)
 	if (dev == NULL)
 		return -1;
 
+#ifdef HAVE_A2DP
 	/* Attempt to locate the transport to get its volume */
 	for (l = transports; l; l = l->next) {
 		struct media_transport *transport = l->data;
@@ -2785,6 +2788,7 @@ int media_transport_get_device_volume(struct btd_device *dev)
 			return -1;
 		}
 	}
+#endif
 
 	/* If transport volume doesn't exists use device_volume */
 	return btd_device_get_volume(dev);
@@ -2798,6 +2802,7 @@ void media_transport_update_device_volume(struct btd_device *dev,
 	if (dev == NULL || volume < 0)
 		return;
 
+#ifdef HAVE_A2DP
 	/* Attempt to locate the transport to set its volume */
 	for (l = transports; l; l = l->next) {
 		struct media_transport *transport = l->data;
@@ -2814,6 +2819,7 @@ void media_transport_update_device_volume(struct btd_device *dev,
 			break;
 		}
 	}
+#endif
 
 	btd_device_set_volume(dev, volume);
 }
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-25 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-22 16:10 [PATCH bluez v1] transport/audio: fix build with a2dp support disabled Peter Seiderer
2025-11-22 17:03 ` [bluez,v1] " bluez.test.bot
2025-11-25 16:30 ` [PATCH bluez v1] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox