transport/audio: fix build with a2dp support disabled
PATCH 1/1 transport/audio: fix build with a2dp support disabled
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
---
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(-)
profiles/audio/media.c +18 -1
@@ -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) {
profiles/audio/transport.c +6 -0
@@ -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); }
Signature · 1 line
2.51.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1026619
---Test result---
Test Summary:
CheckPatch PENDING 0.29 seconds GitLint PENDING 0.38 seconds BuildEll PASS 20.31 seconds BluezMake PASS 647.18 seconds MakeCheck PASS 22.31 seconds MakeDistcheck PASS 237.92 seconds CheckValgrind PASS 293.48 seconds CheckSmatch PASS 341.57 seconds bluezmakeextell PASS 179.65 seconds IncrementalBuild PENDING 0.24 seconds ScanBuild PASS 974.12 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 17 lines · On Sat, 22 Nov 2025 17:10:46 +0100 you wrote:
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 toa2dp_add_sep' /usr/lib64/gcc/x86_64-suse-linux/bin/ld: profiles/audio/bluetoothd-media.o: in functionendpoint_init_a2dp_source':
.../bluez-5.85/profiles/audio/media.c:715:(.text.endpoint_init_a2dp_source+0x28): undefined reference toa2dp_add_sep' /usr/lib64/gcc/x86_64-suse-linux/bin/ld: profiles/audio/bluetoothd-media.o: in functionset_configuration':
.../bluez-5.85/profiles/audio/media.c:512:(.text.set_config+0x35): undefined reference toa2dp_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 toa2dp_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 toa2dp_remove_sep' /usr/lib64/gcc/x86_64-suse-linux/bin/ld: profiles/audio/bluetoothd-media.o: in functionendpoint_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
Quoted 1 line
[...]
Here is the summary with links:
- [bluez,v1] transport/audio: fix build with a2dp support disabled
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0b7395a34796
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html