All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] bap: Mark devices to auto-connect
@ 2023-03-29 23:25 Luiz Augusto von Dentz
  2023-03-29 23:25 ` [PATCH v2 2/2] device: Fix not setting initiator flag when auto-connecting Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2023-03-29 23:25 UTC (permalink / raw)
  To: linux-bluetooth

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

This makes devices with BAP support to auto-connect once they start
advertising.
---
 profiles/audio/bap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index cfe6854663fa..464f365a93bc 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -1352,6 +1352,7 @@ static struct btd_profile bap_profile = {
 	.device_remove	= bap_remove,
 	.accept		= bap_accept,
 	.disconnect	= bap_disconnect,
+	.auto_connect	= true,
 };
 
 static unsigned int bap_id = 0;
-- 
2.39.2


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

* [PATCH v2 2/2] device: Fix not setting initiator flag when auto-connecting
  2023-03-29 23:25 [PATCH v2 1/2] bap: Mark devices to auto-connect Luiz Augusto von Dentz
@ 2023-03-29 23:25 ` Luiz Augusto von Dentz
  2023-03-30  0:41 ` [v2,1/2] bap: Mark devices to auto-connect bluez.test.bot
  2023-03-30 18:10 ` [PATCH v2 1/2] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2023-03-29 23:25 UTC (permalink / raw)
  To: linux-bluetooth

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

If the device is marked as auto-connect the kernel may initiate the
connection spontaneously causing new connections to not have set the
state->initiator flag properly.
---
 src/device.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index f31f2a097e07..b43ced8b5c91 100644
--- a/src/device.c
+++ b/src/device.c
@@ -312,9 +312,16 @@ static struct bearer_state *get_state(struct btd_device *dev,
 
 bool btd_device_is_initiator(struct btd_device *dev)
 {
-	if (dev->le_state.connected)
+	if (dev->le_state.connected) {
+		/* Mark as initiator if not set yet and auto-connect flag is
+		 * set and LTK key is for a peripheral.
+		 */
+		if (!dev->le_state.initiator && dev->auto_connect &&
+					dev->ltk && !dev->ltk->central)
+			dev->le_state.initiator = true;
+
 		return dev->le_state.initiator;
-	if (dev->bredr_state.connected)
+	} else if (dev->bredr_state.connected)
 		return dev->bredr_state.initiator;
 
 	return dev->att_io ? true : false;
-- 
2.39.2


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

* RE: [v2,1/2] bap: Mark devices to auto-connect
  2023-03-29 23:25 [PATCH v2 1/2] bap: Mark devices to auto-connect Luiz Augusto von Dentz
  2023-03-29 23:25 ` [PATCH v2 2/2] device: Fix not setting initiator flag when auto-connecting Luiz Augusto von Dentz
@ 2023-03-30  0:41 ` bluez.test.bot
  2023-03-30 18:10 ` [PATCH v2 1/2] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2023-03-30  0:41 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 946 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=735183

---Test result---

Test Summary:
CheckPatch                    PASS      0.76 seconds
GitLint                       PASS      0.54 seconds
BuildEll                      PASS      26.81 seconds
BluezMake                     PASS      762.58 seconds
MakeCheck                     PASS      10.82 seconds
MakeDistcheck                 PASS      148.65 seconds
CheckValgrind                 PASS      241.53 seconds
CheckSmatch                   PASS      322.74 seconds
bluezmakeextell               PASS      97.30 seconds
IncrementalBuild              PASS      1226.54 seconds
ScanBuild                     PASS      970.92 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH v2 1/2] bap: Mark devices to auto-connect
  2023-03-29 23:25 [PATCH v2 1/2] bap: Mark devices to auto-connect Luiz Augusto von Dentz
  2023-03-29 23:25 ` [PATCH v2 2/2] device: Fix not setting initiator flag when auto-connecting Luiz Augusto von Dentz
  2023-03-30  0:41 ` [v2,1/2] bap: Mark devices to auto-connect bluez.test.bot
@ 2023-03-30 18:10 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2023-03-30 18:10 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

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

On Wed, 29 Mar 2023 16:25:36 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This makes devices with BAP support to auto-connect once they start
> advertising.
> ---
>  profiles/audio/bap.c | 1 +
>  1 file changed, 1 insertion(+)

Here is the summary with links:
  - [v2,1/2] bap: Mark devices to auto-connect
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=ca07d198f9c7
  - [v2,2/2] device: Fix not setting initiator flag when auto-connecting
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=2b022fa5297a

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] 4+ messages in thread

end of thread, other threads:[~2023-03-30 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 23:25 [PATCH v2 1/2] bap: Mark devices to auto-connect Luiz Augusto von Dentz
2023-03-29 23:25 ` [PATCH v2 2/2] device: Fix not setting initiator flag when auto-connecting Luiz Augusto von Dentz
2023-03-30  0:41 ` [v2,1/2] bap: Mark devices to auto-connect bluez.test.bot
2023-03-30 18:10 ` [PATCH v2 1/2] " patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.