client: Fix transport.acquire auto not working as initiator
Luiz Augusto von Dentz
maintainerPATCH 1/1 client: Fix transport.acquire auto not working as initiator
From: Luiz Augusto von Dentz <[email protected]>
Transports configured as client/initiator do not transit to State:pending since that is used to indicate that a stream has been configured and has to be accepted, when acting as initiator role SelectProperties/SelectConfiguration can used to indicate that endpoint stream configuration has been initiated locally so use that to mark endpoint to auto configure if that has been set.
--- client/player.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)
client/player.c +62 -0
@@ -112,10 +112,13 @@ struct endpoint {uint16_t supported_context;uint16_t context;bool auto_accept; +bool auto_acquire;uint8_t max_transports;uint8_t iso_group;uint8_t iso_stream;struct queue *acquiring; +struct queue *auto_acquiring; +unsigned int auto_acquiring_id;struct queue *selecting;unsigned int selecting_id;struct queue *transports;
@@ -1170,6 +1173,51 @@ static void ep_set_selecting(struct endpoint *ep, const char *path) NULL); } +static void transport_acquire (GDBusProxy *proxy,bool prompt); + +static bool ep_auto_acquiring_process (void *user_data) +{ +struct endpoint *ep = user_data; +const struct queue_entry *entry; + + ep->auto_acquiring_id =0 ; + +if (queue_isempty (ep->auto_acquiring)) +return true; + +for (entry =queue_get_entries (ep->auto_acquiring); entry; + entry = entry->next) { +GDBusProxy *proxy; + + proxy =g_dbus_proxy_lookup (transports,NULL , entry->data, +BLUEZ_MEDIA_TRANSPORT_INTERFACE ); +if (!proxy) +continue ; + +transport_acquire (proxy, false); + } + +queue_destroy (ep->auto_acquiring,NULL ); + ep->auto_acquiring =NULL ; + +return true; +} + +static void ep_set_auto_acquiring (struct endpoint *ep,const char *path) +{ +bt_shell_printf ("Transport %s auto acquiring\n" , path); + +if (!ep->auto_acquiring) + ep->auto_acquiring =queue_new (); + +queue_push_tail (ep->auto_acquiring,strdup (path)); + +if (!ep->auto_acquiring_id) + ep->auto_acquiring_id =timeout_add (1000 , + ep_auto_acquiring_process, + ep,NULL ); +} +static DBusMessage *endpoint_set_configuration (DBusConnection *conn,DBusMessage *msg,void *user_data) {
@@ -1209,6 +1257,8 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn,if (ep->auto_accept) {if (auto_select && ep->broadcast)ep_set_selecting (ep, path); +else if (ep->auto_acquire && !ep->broadcast) +ep_set_auto_acquiring (ep, path);bt_shell_printf ("Auto Accepting...\n" );return g_dbus_create_reply (msg,DBUS_TYPE_INVALID );
@@ -1815,6 +1865,11 @@ static DBusMessage *endpoint_select_configuration(DBusConnection *conn,bt_shell_printf ("Auto Accepting using %s...\n" , p->name); +/* Mark auto_acquire if set so the transport is acquired upon +* SetConfiguration. +*/ + ep->auto_acquire = auto_acquire; +return reply; }
@@ -2264,6 +2319,11 @@ static DBusMessage *endpoint_select_properties(DBusConnection *conn,if (!reply)return NULL ; +/* Mark auto_acquire if set so the transport is acquired upon +* SetConfiguration. +*/ + ep->auto_acquire = auto_acquire; +return reply; }
@@ -3015,8 +3075,10 @@ static void endpoint_free(void *data)free (ep->preset);timeout_remove (ep->selecting_id); +timeout_remove (ep->auto_acquiring_id);queue_destroy (ep->acquiring,NULL ); +queue_destroy (ep->auto_acquiring, free);queue_destroy (ep->selecting, free);queue_destroy (ep->transports, free);
Signature · 1 line
2.52.0
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=1029860
---Test result---
Test Summary:
CheckPatch PENDING 0.28 seconds GitLint PENDING 0.27 seconds BuildEll PASS 20.20 seconds BluezMake PASS 628.50 seconds MakeCheck PASS 22.09 seconds MakeDistcheck PASS 241.04 seconds CheckValgrind PASS 296.43 seconds CheckSmatch PASS 343.85 seconds bluezmakeextell PASS 181.55 seconds IncrementalBuild PENDING 0.33 seconds ScanBuild PASS 978.80 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 10 lines · On Tue, 2 Dec 2025 15:18:10 -0500 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
Transports configured as client/initiator do not transit to State:pending since that is used to indicate that a stream has been configured and has to be accepted, when acting as initiator role SelectProperties/SelectConfiguration can used to indicate that endpoint stream configuration has been initiated locally so use that to mark endpoint to auto configure if that has been set.
[...]
Here is the summary with links:
- [BlueZ,v1] client: Fix transport.acquire auto not working as initiator
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=d383c81f848d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html