public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v1] client: Fix transport.acquire auto not working as initiator
@ 2025-12-02 20:18 Luiz Augusto von Dentz
  2025-12-02 21:13 ` [BlueZ,v1] " bluez.test.bot
  2025-12-04 16:00 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2025-12-02 20:18 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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(+)

diff --git a/client/player.c b/client/player.c
index 121c64f0a8d4..b6b02a0001b8 100644
--- a/client/player.c
+++ b/client/player.c
@@ -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);
 
-- 
2.52.0


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

* RE: [BlueZ,v1] client: Fix transport.acquire auto not working as initiator
  2025-12-02 20:18 [PATCH BlueZ v1] client: Fix transport.acquire auto not working as initiator Luiz Augusto von Dentz
@ 2025-12-02 21:13 ` bluez.test.bot
  2025-12-04 16:00 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2025-12-02 21:13 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]

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


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

* Re: [PATCH BlueZ v1] client: Fix transport.acquire auto not working as initiator
  2025-12-02 20:18 [PATCH BlueZ v1] client: Fix transport.acquire auto not working as initiator Luiz Augusto von Dentz
  2025-12-02 21:13 ` [BlueZ,v1] " bluez.test.bot
@ 2025-12-04 16:00 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2025-12-04 16:00 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue,  2 Dec 2025 15:18:10 -0500 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> 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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-12-04 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02 20:18 [PATCH BlueZ v1] client: Fix transport.acquire auto not working as initiator Luiz Augusto von Dentz
2025-12-02 21:13 ` [BlueZ,v1] " bluez.test.bot
2025-12-04 16:00 ` [PATCH BlueZ v1] " 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