From c6dcf6b714501768ab7ea293e75d945be0eec188 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Wed, 17 Sep 2025 01:00:14 +0200 Subject: [PATCH] transport: Fix build with VCP support disabled $ $ ./bootstrap-configure --enable-a2dp --enable-avrcp --enable-experimental --enable-asha --disable-vcp && make [...] /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function `transport_bap_set_volume': profiles/audio/transport.c:2275:(.text.transport_bap_set_volume+0x11): undefined reference to `bt_audio_vcp_set_volume' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function `transport_bap_get_volume': profiles/audio/transport.c:2266:(.text.transport_bap_get_volume+0x9): undefined reference to `bt_audio_vcp_get_volume' Reported-by: Arun Raghavan Fixes: af8266af13c8 ("audio: connect VCP profile client to MediaTransport") --- configure.ac | 3 +++ profiles/audio/transport.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/configure.ac b/configure.ac index 955908621..9f1a96600 100644 --- a/configure.ac +++ b/configure.ac @@ -215,6 +215,9 @@ AM_CONDITIONAL(CCP, test "${enable_ccp}" != "no") AC_ARG_ENABLE(vcp, AS_HELP_STRING([--disable-vcp], [disable VCP profile]), [enable_vcp=${enableval}]) AM_CONDITIONAL(VCP, test "${enable_vcp}" != "no") +if test "${enable_vcp}" != "no"; then + AC_DEFINE(HAVE_VCP, 1, [Define to 1 if you have VCP support.]) +fi AC_ARG_ENABLE(micp, AS_HELP_STRING([--disable-micp], [disable MICP profile]), [enable_micp=${enableval}]) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index ab149bcd7..2682a2e4e 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -2263,16 +2263,24 @@ static void bap_connecting(struct bt_bap_stream *stream, bool state, int fd, static int transport_bap_get_volume(struct media_transport *transport) { +#ifdef HAVE_VCP return bt_audio_vcp_get_volume(transport->device); +#else + return -ENODEV; +#endif /* HAVE_VCP */ } static int transport_bap_set_volume(struct media_transport *transport, int volume) { +#ifdef HAVE_VCP if (volume < 0 || volume > 255) return -EINVAL; return bt_audio_vcp_set_volume(transport->device, volume) ? 0 : -EIO; +#else + return -ENODEV; +#endif /* HAVE_VCP */ } static void transport_bap_destroy(void *data) -- 2.47.3