public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] transport: Fix build with VCP support disabled
@ 2025-09-16 23:00 Bastien Nocera
  2025-09-17  0:29 ` [BlueZ] " bluez.test.bot
  2025-09-17 13:30 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Bastien Nocera @ 2025-09-16 23:00 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Arun Raghavan

$ $ ./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 <arun@accosted.net>
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 955908621b6d..9f1a96600a7a 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 2fceb5121a34..bc550b743981 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.51.0


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

end of thread, other threads:[~2025-09-17 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-16 23:00 [PATCH BlueZ] transport: Fix build with VCP support disabled Bastien Nocera
2025-09-17  0:29 ` [BlueZ] " bluez.test.bot
2025-09-17 13:30 ` [PATCH BlueZ] " 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