public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] transport: Fix set volume failure with invalid device volume
@ 2026-03-09 11:18 Jinwang Li
  2026-03-09 12:28 ` [v3] " bluez.test.bot
  2026-03-09 14:00 ` [PATCH v3] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Jinwang Li @ 2026-03-09 11:18 UTC (permalink / raw)
  To: luiz.dentz, linux-bluetooth
  Cc: cheng.jiang, quic_chezhou, wei.deng, shuai.zhang, mengshi.wu,
	jinwang.li, Luiz Augusto von Dentz

When AVRCP is connected before AVDTP, an invalid device volume causes
the target to reject registration for the EVENT_VOLUME_CHANGED
notification, which breaks subsequent volume updates.

Fix this by initializing the volume to the maximum value in the AVRCP
target init path when it is invalid, allowing the controller to
subscribe to AVRCP_EVENT_VOLUME_CHANGED.

Fixes: fa7828bddd21 ("transport: Fix not being able to initialize volume properly")
Suggested-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Jinwang Li <jinwang.li@oss.qualcomm.com>
---
 profiles/audio/avrcp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Changes from v2:
 - Initialize the volume in the AVRCP target init path instead of
   returning a fallback value from media_transport_get_a2dp_volume().
 - Set the volume to the maximum value only when it is still invalid,
   avoiding role-dependent behavior issues.
 - Link to v1
   https://lore.kernel.org/all/20260305083833.369358-1-jinwang.li@oss.qualcomm.com/

Changes from v1:
 - Return the max volume from media_transport_get_a2dp_volume()
   when there is no A2DP transport and the device volume is invalid.
 - Restore the default device volume in device_new().
 - Update the commit subject name.
 - Link to v1
   https://lore.kernel.org/all/20260122063640.310090-1-jinwang.li@oss.qualcomm.com/

diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 724b46c59..326dfdab7 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -4296,9 +4296,16 @@ static void target_init(struct avrcp *session)
 	if (target->version < 0x0104)
 		return;
 
-	if (avrcp_volume_supported(target))
+	if (avrcp_volume_supported(target)) {
 		session->supported_events |=
 				(1 << AVRCP_EVENT_VOLUME_CHANGED);
+		/* Check if transport volume hasn't been initialized then set it
+		 * to max so it works properly if the controller attempts to
+		 * subscribe to AVRCP_EVENT_VOLUME_CHANGED.
+		 */
+		if (media_transport_get_a2dp_volume(session->dev) < 0)
+			media_transport_set_a2dp_volume(session->dev, 127);
+	}
 
 	session->supported_events |=
 				(1 << AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED) |
-- 
2.34.1


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

* RE: [v3] transport: Fix set volume failure with invalid device volume
  2026-03-09 11:18 [PATCH v3] transport: Fix set volume failure with invalid device volume Jinwang Li
@ 2026-03-09 12:28 ` bluez.test.bot
  2026-03-09 14:00 ` [PATCH v3] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-03-09 12:28 UTC (permalink / raw)
  To: linux-bluetooth, jinwang.li

[-- 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=1063601

---Test result---

Test Summary:
CheckPatch                    PENDING   0.31 seconds
GitLint                       PENDING   0.35 seconds
BuildEll                      PASS      18.10 seconds
BluezMake                     PASS      647.42 seconds
MakeCheck                     PASS      17.80 seconds
MakeDistcheck                 PASS      224.06 seconds
CheckValgrind                 PASS      282.15 seconds
CheckSmatch                   PASS      320.31 seconds
bluezmakeextell               PASS      170.43 seconds
IncrementalBuild              PENDING   0.87 seconds
ScanBuild                     PASS      950.75 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 v3] transport: Fix set volume failure with invalid device volume
  2026-03-09 11:18 [PATCH v3] transport: Fix set volume failure with invalid device volume Jinwang Li
  2026-03-09 12:28 ` [v3] " bluez.test.bot
@ 2026-03-09 14:00 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-03-09 14:00 UTC (permalink / raw)
  To: Jinwang Li
  Cc: luiz.dentz, linux-bluetooth, cheng.jiang, quic_chezhou, wei.deng,
	shuai.zhang, mengshi.wu, luiz.von.dentz

Hello:

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

On Mon,  9 Mar 2026 19:18:26 +0800 you wrote:
> When AVRCP is connected before AVDTP, an invalid device volume causes
> the target to reject registration for the EVENT_VOLUME_CHANGED
> notification, which breaks subsequent volume updates.
> 
> Fix this by initializing the volume to the maximum value in the AVRCP
> target init path when it is invalid, allowing the controller to
> subscribe to AVRCP_EVENT_VOLUME_CHANGED.
> 
> [...]

Here is the summary with links:
  - [v3] transport: Fix set volume failure with invalid device volume
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=121e5ca79be5

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:[~2026-03-09 14:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 11:18 [PATCH v3] transport: Fix set volume failure with invalid device volume Jinwang Li
2026-03-09 12:28 ` [v3] " bluez.test.bot
2026-03-09 14:00 ` [PATCH v3] " 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