build: Fix --disable-avrcp
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH 1/2 build: Fix --disable-avrcp
From: Luiz Augusto von Dentz <[email protected]>
This fixes --disable-avrcp causing build errors.
--- Makefile.plugins | 9 +++++---- configure.ac | 3 +++ profiles/audio/media.c | 38 +++++++++++++++++++++++++++++++++++++- profiles/audio/transport.c | 10 ++++++++++ 4 files changed, 55 insertions(+), 5 deletions(-)
Makefile.plugins +5 -4
@@ -8,6 +8,10 @@ builtin_sources += plugins/autopair.c builtin_modules += policy builtin_sources += plugins/policy.c +builtin_sources += profiles/audio/media.h profiles/audio/media.c \ + profiles/audio/transport.h profiles/audio/transport.c \ + profiles/audio/player.h profiles/audio/player.c + if ADMIN builtin_modules += admin builtin_sources += plugins/admin.c
@@ -32,8 +36,6 @@ builtin_sources += profiles/audio/source.h profiles/audio/source.c \ profiles/audio/sink.h profiles/audio/sink.c \ profiles/audio/a2dp.h profiles/audio/a2dp.c \ profiles/audio/avdtp.h profiles/audio/avdtp.c \ - profiles/audio/media.h profiles/audio/media.c \ - profiles/audio/transport.h profiles/audio/transport.c \ profiles/audio/a2dp-codecs.h endif
@@ -42,8 +44,7 @@ if AVRCP builtin_modules += avrcp builtin_sources += profiles/audio/control.h profiles/audio/control.c \ profiles/audio/avctp.h profiles/audio/avctp.c \ - profiles/audio/avrcp.h profiles/audio/avrcp.c \ - profiles/audio/player.h profiles/audio/player.c + profiles/audio/avrcp.h profiles/audio/avrcp.c endif if NETWORK
configure.ac +3 -0
@@ -180,6 +180,9 @@ AM_CONDITIONAL(A2DP, test "${enable_a2dp}" != "no") AC_ARG_ENABLE(avrcp, AS_HELP_STRING([--disable-avrcp], [disable AVRCP profile]), [enable_avrcp=${enableval}]) AM_CONDITIONAL(AVRCP, test "${enable_avrcp}" != "no") +if test "${enable_avrcp}" != "no"; then + AC_DEFINE(HAVE_AVRCP, 1, [Define to 1 if you have AVRCP support.]) +fi AC_ARG_ENABLE(network, AS_HELP_STRING([--disable-network], [disable network profiles]), [enable_network=${enableval}])
profiles/audio/media.c +37 -1
@@ -49,7 +49,10 @@#include "media.h" #include "transport.h" #include "a2dp.h" + +#ifdef HAVE_AVRCP #include "avrcp.h" +#endif #define MEDIA_INTERFACE "org.bluez.Media1"#define MEDIA_ENDPOINT_INTERFACE "org.bluez.MediaEndpoint1"
@@ -65,7 +68,9 @@ struct media_app {char *path;/* Application object path */ struct queue *proxies;/* Application proxies */ struct queue *endpoints;/* Application endpoints */ +#ifdef HAVE_AVRCP struct queue *players;/* Application players */ +#endif int err; };
@@ -73,7 +78,9 @@ struct media_adapter {struct btd_adapter *btd_adapter;struct queue *apps;/* Application list */ GSList *endpoints;/* Endpoints list */ +#ifdef HAVE_AVRCP GSList *players;/* Players list */ +#endif };struct endpoint_request {
@@ -482,6 +489,7 @@ struct a2dp_config_data {int8_t media_player_get_device_volume (struct btd_device *device) { +#ifdef HAVE_AVRCP struct avrcp_player *target_player;struct media_adapter *adapter;GSList *l;
@@ -505,6 +513,7 @@ int8_t media_player_get_device_volume(struct btd_device *device) } done: +#endif /* HAVE_AVRCP */ /* If media_player doesn't exists use device_volume */ return btd_device_get_volume (device); }
@@ -1760,6 +1769,7 @@ static DBusMessage *unregister_endpoint(DBusConnection *conn, DBusMessage *msg,return g_dbus_create_reply (msg,DBUS_TYPE_INVALID ); } +#ifdef HAVE_AVRCP static struct media_player *media_adapter_find_player( struct media_adapter *adapter, const char *sender,
@@ -2649,10 +2659,12 @@ static struct media_player *media_player_create(struct media_adapter *adapter, return mp; } +#endif /* HAVE_AVRCP */ static DBusMessage *register_player (DBusConnection *conn,DBusMessage *msg,void *data) { +#ifdef HAVE_AVRCP struct media_adapter *adapter = data;struct media_player *mp;DBusMessageIter args;
@@ -2683,11 +2695,15 @@ static DBusMessage *register_player(DBusConnection *conn, DBusMessage *msg, }return g_dbus_create_reply (msg,DBUS_TYPE_INVALID ); +#else +return btd_error_not_supported (msg); +#endif }static DBusMessage *unregister_player (DBusConnection *conn,DBusMessage *msg,void *data) { +#ifdef HAVE_AVRCP struct media_adapter *adapter = data;struct media_player *player;const char *sender, *path;
@@ -2706,6 +2722,9 @@ static DBusMessage *unregister_player(DBusConnection *conn, DBusMessage *msg,media_player_remove (player);return g_dbus_create_reply (msg,DBUS_TYPE_INVALID ); +#else +return btd_error_not_supported (msg); +#endif }static void app_free (void *data)
@@ -2714,7 +2733,9 @@ static void app_free(void *data)queue_destroy (app->proxies,NULL );queue_destroy (app->endpoints, media_endpoint_remove); +#ifdef HAVE_AVRCP queue_destroy (app->players, media_player_remove); +#endif if (app->client) {g_dbus_client_set_disconnect_watch (app->client,NULL ,NULL );
@@ -2913,6 +2934,7 @@ fail:static void app_register_player (void *data,void *user_data) { +#ifdef HAVE_AVRCP struct media_app *app = user_data;GDBusProxy *proxy = data;const char *iface =g_dbus_proxy_get_interface (proxy);
@@ -2994,6 +3016,7 @@ fail:error ("Unable to register player %s:%s: %s" , app->sender, path,strerror (-app->err));media_player_destroy (player); +#endif /* HAVE_AVRCP */ }static void remove_app (void *data)
@@ -3042,7 +3065,11 @@ static void client_ready_cb(GDBusClient *client, void *user_data) goto reply; } +#ifdef HAVE_AVRCP if ((queue_isempty (app->endpoints) &&queue_isempty (app->players))) { +#else +if (queue_isempty (app->endpoints)) { +#endif error ("No valid external Media objects found" ); fail = true; reply = btd_error_failed(app->reg,
@@ -3091,6 +3118,7 @@ static bool match_endpoint_by_path(const void *a, const void *b)return !strcmp (endpoint->path, path); } +#ifdef HAVE_AVRCP static bool match_player_by_path (const void *a,const void *b) {const struct media_player *player = a;
@@ -3098,12 +3126,12 @@ static bool match_player_by_path(const void *a, const void *b) return !strcmp(player->path, path); } +#endif static void proxy_removed_cb (GDBusProxy *proxy,void *user_data) {struct media_app *app = user_data;struct media_endpoint *endpoint; -struct media_player *player;const char *iface, *path; iface =g_dbus_proxy_get_interface (proxy);
@@ -3122,7 +3150,10 @@ static void proxy_removed_cb(GDBusProxy *proxy, void *user_data)DBG ("Proxy removed - removing endpoint: %s" , endpoint->path);media_endpoint_remove (endpoint); +#ifdef HAVE_AVRCP }else if (!strcmp (iface,MEDIA_PLAYER_INTERFACE )) { +struct media_player *player; + player =queue_remove_if (app->players, match_player_by_path, (void *) path);if (!player)
@@ -3134,6 +3165,7 @@ static void proxy_removed_cb(GDBusProxy *proxy, void *user_data)DBG ("Proxy removed - removing player: %s" , player->path);media_player_remove (player); +#endif } }
@@ -3162,7 +3194,9 @@ static struct media_app *create_app(DBusConnection *conn, DBusMessage *msg, app->proxies =queue_new (); app->endpoints =queue_new (); +#ifdef HAVE_AVRCP app->players =queue_new (); +#endif app->reg =dbus_message_ref (msg); g_dbus_client_set_disconnect_watch(app->client, client_disconnect_cb,
@@ -3326,6 +3360,7 @@ static void path_free(void *data)release_endpoint (endpoint); } +#ifdef HAVE_AVRCP for (l = adapter->players; l;) {struct media_player *mp = l->data;
@@ -3333,6 +3368,7 @@ static void path_free(void *data) media_player_destroy(mp); } +#endif adapters =g_slist_remove (adapters, adapter);
profiles/audio/transport.c +10 -0
@@ -612,6 +612,7 @@ static int8_t transport_a2dp_get_volume(struct media_transport *transport)return a2dp->volume; } +#ifdef HAVE_AVRCP static int transport_a2dp_src_set_volume (struct media_transport *transport,int8_t level) {
@@ -643,6 +644,7 @@ static int transport_a2dp_snk_set_volume(struct media_transport *transport, return avrcp_set_volume(transport->device, level, notify); } +#endif static int transport_a2dp_snk_set_delay (struct media_transport *transport,uint16_t delay)
@@ -2409,11 +2411,19 @@ static void *transport_asha_init(struct media_transport *transport, void *data)static const struct media_transport_ops transport_ops[] = {A2DP_OPS (A2DP_SOURCE_UUID , transport_a2dp_src_init, +#ifdef HAVE_AVRCP transport_a2dp_src_set_volume, +#else +NULL , +#endifNULL , transport_a2dp_src_destroy),A2DP_OPS (A2DP_SINK_UUID , transport_a2dp_snk_init, +#ifdef HAVE_AVRCP transport_a2dp_snk_set_volume, +#else +NULL , +#endif transport_a2dp_snk_set_delay, transport_a2dp_snk_destroy),BAP_UC_OPS (PAC_SOURCE_UUID ),
Signature · 1 line
2.47.1
Luiz Augusto von Dentz
maintainerPATCH 2/2 build: Fix --disable-a2dp
From: Luiz Augusto von Dentz <[email protected]>
This fixes --disable-a2dp causing build errors:
/usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function `transport_a2dp_snk_init':
/bluez/profiles/audio/transport.c:1742:(.text.transport_a2dp_snk_init+0x49): undefined reference to source_add_state_cb' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function transport_a2dp_destroy':
/bluez/profiles/audio/transport.c:1578:(.text.transport_a2dp_src_destroy+0x14): undefined reference to avdtp_unref' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function transport_a2dp_src_destroy':
/bluez/profiles/audio/transport.c:1588:(.text.transport_a2dp_src_destroy+0x29): undefined reference to sink_remove_state_cb' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function transport_a2dp_get_stream':
/bluez/profiles/audio/transport.c:397:(.text.transport_a2dp_get_stream+0x1a): undefined reference to a2dp_sep_get_stream' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function transport_a2dp_cancel':
/bluez/profiles/audio/transport.c:586:(.text.transport_a2dp_cancel+0xc): undefined reference to a2dp_cancel' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function transport_a2dp_remove_owner':
/bluez/profiles/audio/transport.c:602:(.text.transport_a2dp_remove_owner+0x34): undefined reference to a2dp_cancel' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function transport_a2dp_src_init':
/bluez/profiles/audio/transport.c:1725:(.text.transport_a2dp_src_init+0x49): undefined reference to sink_add_state_cb' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function transport_a2dp_destroy':
/bluez/profiles/audio/transport.c:1578:(.text.transport_a2dp_snk_destroy+0x14): undefined reference to avdtp_unref' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function transport_a2dp_snk_destroy':
/bluez/profiles/audio/transport.c:1598:(.text.transport_a2dp_snk_destroy+0x29): undefined reference to source_remove_state_cb' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function transport_a2dp_suspend':
/bluez/profiles/audio/transport.c:438:(.text.transport_a2dp_suspend+0x79): undefined reference to a2dp_sep_unlock' /usr/bin/ld: /bluez/profiles/audio/transport.c:433:(.text.transport_a2dp_suspend+0x5a): undefined reference to a2dp_suspend' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function `a2dp_suspend_complete':
/bluez/profiles/audio/transport.c:415:(.text.a2dp_suspend_complete+0x47): undefined reference to a2dp_sep_unlock' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function transport_a2dp_resume':
/bluez/profiles/audio/transport.c:555:(.text.transport_a2dp_resume+0x4d): undefined reference to a2dp_sep_lock' /usr/bin/ld: /bluez/profiles/audio/transport.c:550:(.text.transport_a2dp_resume+0x76): undefined reference to a2dp_resume' /usr/bin/ld: /bluez/profiles/audio/transport.c:558:(.text.transport_a2dp_resume+0xa2): undefined reference to a2dp_resume' /usr/bin/ld: /bluez/profiles/audio/transport.c:544:(.text.transport_a2dp_resume+0xd5): undefined reference to a2dp_avdtp_get' /usr/bin/ld: /bluez/profiles/audio/transport.c:561:(.text.transport_a2dp_resume+0xf8): undefined reference to a2dp_sep_unlock' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function transport_a2dp_get_stream':
/bluez/profiles/audio/transport.c:397:(.text.a2dp_resume_complete+0x82): undefined reference to a2dp_sep_get_stream' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function a2dp_resume_complete':
/bluez/profiles/audio/transport.c:508:(.text.a2dp_resume_complete+0xcc): undefined reference to avdtp_stream_get_transport' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function transport_a2dp_snk_set_delay':
/bluez/profiles/audio/transport.c:659:(.text.transport_a2dp_snk_set_delay+0x95): undefined reference to a2dp_avdtp_get' /usr/bin/ld: /bluez/profiles/audio/transport.c:676:(.text.transport_a2dp_snk_set_delay+0x52): undefined reference to avdtp_delay_report' /usr/bin/ld: profiles/audio/bluetoothd-transport.o: in function `delay_reporting_exists':
/bluez/profiles/audio/transport.c:1000:(.text.delay_reporting_exists+0x19): undefined reference to `avdtp_stream_has_delay_reporting'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:6378: src/bluetoothd] Error 1
make: *** [Makefile:4696: all] Error 2
--- configure.ac | 3 +++ profiles/audio/transport.c | 21 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-)
configure.ac +3 -0
@@ -176,6 +176,9 @@ AM_CONDITIONAL(SAP, test "${enable_sap}" = "yes") AC_ARG_ENABLE(a2dp, AS_HELP_STRING([--disable-a2dp], [disable A2DP profile]), [enable_a2dp=${enableval}]) AM_CONDITIONAL(A2DP, test "${enable_a2dp}" != "no") +if test "${enable_a2dp}" != "no"; then + AC_DEFINE(HAVE_A2DP, 1, [Define to 1 if you have A2DP support.]) +fi AC_ARG_ENABLE(avrcp, AS_HELP_STRING([--disable-avrcp], [disable AVRCP profile]), [enable_avrcp=${enableval}])
profiles/audio/transport.c +18 -3
@@ -38,13 +38,16 @@#include "src/shared/bass.h" #include "src/shared/io.h" -#include "asha.h" +#ifdef HAVE_A2DP #include "avdtp.h" -#include "media.h" -#include "transport.h" #include "a2dp.h" #include "sink.h" #include "source.h" +#endif + +#include "asha.h" +#include "media.h" +#include "transport.h" #include "avrcp.h" #include "bass.h"
@@ -387,6 +390,7 @@ static gboolean media_transport_set_fd(struct media_transport *transport,return TRUE; } +#ifdef HAVE_A2DP static void *transport_a2dp_get_stream (struct media_transport *transport) {struct a2dp_sep *sep =media_endpoint_get_sep (transport->endpoint);
@@ -675,6 +679,7 @@ static int transport_a2dp_snk_set_delay(struct media_transport *transport, return avdtp_delay_report(a2dp->session, stream, delay); } +#endif /* HAVE_A2DP */ static void media_owner_exit (DBusConnection *connection,void *user_data) {
@@ -987,6 +992,7 @@ static gboolean get_state(const GDBusPropertyTable *property,return TRUE; } +#ifdef HAVE_A2DP static gboolean delay_reporting_exists (const GDBusPropertyTable *property,void *data) {
@@ -1067,6 +1073,7 @@ static void set_delay_report(const GDBusPropertyTable *property, g_dbus_pending_property_success(id); } +#endif /* HAVE_A2DP */ static gboolean volume_exists (const GDBusPropertyTable *property,void *data) {
@@ -1197,6 +1204,7 @@ static const GDBusMethodTable transport_methods[] = { { }, }; +#ifdef HAVE_A2DP static const GDBusPropertyTable transport_a2dp_properties[] = { {"Device" ,"o" , get_device }, { "UUID", "s", get_uuid },
@@ -1210,6 +1218,7 @@ static const GDBusPropertyTable transport_a2dp_properties[] = { G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, { } }; +#endif /* HAVE_A2DP */ static void append_io_qos (DBusMessageIter *dict,struct bt_bap_io_qos *qos) {
@@ -1570,6 +1579,7 @@ static const GDBusPropertyTable transport_asha_properties[] = { { } }; +#ifdef HAVE_A2DP static void transport_a2dp_destroy (void *data) {struct a2dp_transport *a2dp = data;
@@ -1599,6 +1609,7 @@ static void transport_a2dp_snk_destroy(void *data) transport_a2dp_destroy(data); } +#endif /* HAVE_A2DP */ static void media_transport_free (void *data) {
@@ -1684,6 +1695,7 @@ static DBusMessage *unselect_transport(DBusConnection *conn, DBusMessage *msg,return dbus_message_new_method_return (msg); } +#ifdef HAVE_A2DP static void sink_state_changed(struct btd_service *service, sink_state_t old_state, sink_state_t new_state,
@@ -1744,6 +1756,7 @@ static void *transport_a2dp_snk_init(struct media_transport *transport,return a2dp; } +#endif /* HAVE_A2DP */ static void bap_enable_complete(struct bt_bap_stream *stream, uint8_t code, uint8_t reason,
@@ -2410,6 +2423,7 @@ static void *transport_asha_init(struct media_transport *transport, void *data) NULL, NULL, NULL) static const struct media_transport_ops transport_ops[] = { +#ifdef HAVE_A2DP A2DP_OPS(A2DP_SOURCE_UUID, transport_a2dp_src_init, #ifdef HAVE_AVRCP transport_a2dp_src_set_volume,
@@ -2426,6 +2440,7 @@ static const struct media_transport_ops transport_ops[] = {#endif transport_a2dp_snk_set_delay, transport_a2dp_snk_destroy), +#endif /* HAVE_A2DP */ BAP_UC_OPS (PAC_SOURCE_UUID ),BAP_UC_OPS (PAC_SINK_UUID ), BAP_BC_OPS(BCAA_SERVICE_UUID),
Signature · 1 line
2.47.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=923917
---Test result---
Test Summary:
CheckPatch PENDING 0.19 seconds GitLint PENDING 0.24 seconds BuildEll PASS 20.68 seconds BluezMake PASS 1674.84 seconds MakeCheck PASS 13.49 seconds MakeDistcheck PASS 160.75 seconds CheckValgrind PASS 216.12 seconds CheckSmatch PASS 273.86 seconds bluezmakeextell PASS 100.11 seconds IncrementalBuild PENDING 0.28 seconds ScanBuild PASS 853.30 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 series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 11 lines · On Thu, 9 Jan 2025 16:04:59 -0500 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
This fixes --disable-avrcp causing build errors.
--- Makefile.plugins | 9 +++++---- configure.ac | 3 +++ profiles/audio/media.c | 38 +++++++++++++++++++++++++++++++++++++- profiles/audio/transport.c | 10 ++++++++++ 4 files changed, 55 insertions(+), 5 deletions(-)
Here is the summary with links:
- [BlueZ,v1,1/2] build: Fix --disable-avrcp
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=1e1c311243b1 - [BlueZ,v1,2/2] build: Fix --disable-a2dp https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=4f288bd961fc
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html