linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ v1 1/3] sink: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle
@ 2024-11-06 15:49 Luiz Augusto von Dentz
  2024-11-06 15:49 ` [PATCH BlueZ v1 2/3] source: " Luiz Augusto von Dentz
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2024-11-06 15:49 UTC (permalink / raw)
  To: linux-bluetooth

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

If the stream transition to AVDTP_STATE_IDLE it means the stream has
been disconnected, not the session, therefore
btd_service_disconnecting_complete shall not be called otherwise it may
trigger the policy plugin to disconnect AVRCP in cases like codec
reconfiguration.

Fixes: https://github.com/bluez/bluez/issues/1003
---
 profiles/audio/sink.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c
index 77f195436032..7e02bcca1a01 100644
--- a/profiles/audio/sink.c
+++ b/profiles/audio/sink.c
@@ -110,6 +110,7 @@ static void avdtp_state_callback(struct btd_device *dev,
 	switch (new_state) {
 	case AVDTP_SESSION_STATE_DISCONNECTED:
 		sink_set_state(sink, SINK_STATE_DISCONNECTED);
+		btd_service_disconnecting_complete(sink->service, 0);
 		break;
 	case AVDTP_SESSION_STATE_CONNECTING:
 		sink_set_state(sink, SINK_STATE_CONNECTING);
@@ -135,8 +136,6 @@ static void stream_state_changed(struct avdtp_stream *stream,
 
 	switch (new_state) {
 	case AVDTP_STATE_IDLE:
-		btd_service_disconnecting_complete(sink->service, 0);
-
 		if (sink->connect_id > 0) {
 			a2dp_cancel(sink->connect_id);
 			sink->connect_id = 0;
-- 
2.47.0


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

* [PATCH BlueZ v1 2/3] source: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle
  2024-11-06 15:49 [PATCH BlueZ v1 1/3] sink: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle Luiz Augusto von Dentz
@ 2024-11-06 15:49 ` Luiz Augusto von Dentz
  2024-11-06 15:49 ` [PATCH BlueZ v1 3/3] a2dp: Don't wait to reconfigure Luiz Augusto von Dentz
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2024-11-06 15:49 UTC (permalink / raw)
  To: linux-bluetooth

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

If the stream transition to AVDTP_STATE_IDLE it means the stream has
been disconnected, not the session, therefore
btd_service_disconnecting_complete shall not be called otherwise it may
trigger the policy plugin to disconnect AVRCP in cases like codec
reconfiguration.
---
 profiles/audio/source.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/profiles/audio/source.c b/profiles/audio/source.c
index db777e86d542..885e218bfc7c 100644
--- a/profiles/audio/source.c
+++ b/profiles/audio/source.c
@@ -107,6 +107,7 @@ static void avdtp_state_callback(struct btd_device *dev, struct avdtp *session,
 	switch (new_state) {
 	case AVDTP_SESSION_STATE_DISCONNECTED:
 		source_set_state(source, SOURCE_STATE_DISCONNECTED);
+		btd_service_disconnecting_complete(source->service, 0);
 		break;
 	case AVDTP_SESSION_STATE_CONNECTING:
 		source_set_state(source, SOURCE_STATE_CONNECTING);
@@ -132,8 +133,6 @@ static void stream_state_changed(struct avdtp_stream *stream,
 
 	switch (new_state) {
 	case AVDTP_STATE_IDLE:
-		btd_service_disconnecting_complete(source->service, 0);
-
 		if (source->connect_id > 0) {
 			a2dp_cancel(source->connect_id);
 			source->connect_id = 0;
-- 
2.47.0


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

* [PATCH BlueZ v1 3/3] a2dp: Don't wait to reconfigure
  2024-11-06 15:49 [PATCH BlueZ v1 1/3] sink: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle Luiz Augusto von Dentz
  2024-11-06 15:49 ` [PATCH BlueZ v1 2/3] source: " Luiz Augusto von Dentz
@ 2024-11-06 15:49 ` Luiz Augusto von Dentz
  2024-11-06 18:45 ` [BlueZ,v1,1/3] sink: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle bluez.test.bot
  2024-11-06 20:10 ` [PATCH BlueZ v1 1/3] " patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2024-11-06 15:49 UTC (permalink / raw)
  To: linux-bluetooth

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

If the stream has been confirmed to be closed it should be safe to
attempt to send SetConfiguration without having to wait for a period
since the remote end can assume no new stream would be created it may
end up disconnecting the session.
---
 profiles/audio/a2dp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 37332abcad57..c97bd6e89deb 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -58,7 +58,6 @@
 /* The duration that streams without users are allowed to stay in
  * STREAMING state. */
 #define SUSPEND_TIMEOUT 5
-#define RECONFIGURE_TIMEOUT 500
 
 #define AVDTP_PSM 25
 
@@ -1398,7 +1397,7 @@ static bool setup_reconfigure(struct a2dp_setup *setup)
 
 	DBG("%p", setup);
 
-	setup->id = g_timeout_add(RECONFIGURE_TIMEOUT, a2dp_reconfigure, setup);
+	setup->id = g_idle_add(a2dp_reconfigure, setup);
 
 	setup->reconfigure = FALSE;
 
-- 
2.47.0


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

* RE: [BlueZ,v1,1/3] sink: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle
  2024-11-06 15:49 [PATCH BlueZ v1 1/3] sink: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle Luiz Augusto von Dentz
  2024-11-06 15:49 ` [PATCH BlueZ v1 2/3] source: " Luiz Augusto von Dentz
  2024-11-06 15:49 ` [PATCH BlueZ v1 3/3] a2dp: Don't wait to reconfigure Luiz Augusto von Dentz
@ 2024-11-06 18:45 ` bluez.test.bot
  2024-11-06 20:10 ` [PATCH BlueZ v1 1/3] " patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2024-11-06 18:45 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

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

---Test result---

Test Summary:
CheckPatch                    PASS      1.38 seconds
GitLint                       FAIL      1.21 seconds
BuildEll                      PASS      25.68 seconds
BluezMake                     PASS      1790.46 seconds
MakeCheck                     PASS      13.28 seconds
MakeDistcheck                 PASS      186.93 seconds
CheckValgrind                 PASS      258.13 seconds
CheckSmatch                   PASS      368.44 seconds
bluezmakeextell               PASS      123.71 seconds
IncrementalBuild              PASS      4795.54 seconds
ScanBuild                     WARNING   1057.78 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v1,2/3] source: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (82>80): "[BlueZ,v1,2/3] source: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle"
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
profiles/audio/a2dp.c:371:8: warning: Use of memory after it is freed
                if (!cb->resume_cb)
                     ^~~~~~~~~~~~~
1 warning generated.



---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ v1 1/3] sink: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle
  2024-11-06 15:49 [PATCH BlueZ v1 1/3] sink: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle Luiz Augusto von Dentz
                   ` (2 preceding siblings ...)
  2024-11-06 18:45 ` [BlueZ,v1,1/3] sink: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle bluez.test.bot
@ 2024-11-06 20:10 ` patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2024-11-06 20: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,  6 Nov 2024 10:49:15 -0500 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> If the stream transition to AVDTP_STATE_IDLE it means the stream has
> been disconnected, not the session, therefore
> btd_service_disconnecting_complete shall not be called otherwise it may
> trigger the policy plugin to disconnect AVRCP in cases like codec
> reconfiguration.
> 
> [...]

Here is the summary with links:
  - [BlueZ,v1,1/3] sink: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=469a75ae182a
  - [BlueZ,v1,2/3] source: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=2aade568ce77
  - [BlueZ,v1,3/3] a2dp: Don't wait to reconfigure
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=aa118e965b02

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

end of thread, other threads:[~2024-11-06 20:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-06 15:49 [PATCH BlueZ v1 1/3] sink: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle Luiz Augusto von Dentz
2024-11-06 15:49 ` [PATCH BlueZ v1 2/3] source: " Luiz Augusto von Dentz
2024-11-06 15:49 ` [PATCH BlueZ v1 3/3] a2dp: Don't wait to reconfigure Luiz Augusto von Dentz
2024-11-06 18:45 ` [BlueZ,v1,1/3] sink: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle bluez.test.bot
2024-11-06 20:10 ` [PATCH BlueZ v1 1/3] " 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;
as well as URLs for NNTP newsgroup(s).