Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] audio/avrcp: allow early VOLUME_CHANGED register
@ 2026-11-18  2:26 Hank Fan (凡航)
  0 siblings, 0 replies; only message in thread
From: Hank Fan (凡航) @ 2026-11-18  2:26 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org; +Cc: Hank Fan (凡航)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 2102 bytes --]

From 60b4b5356dfec2229b4c3df8bcc3feab075d3d3d Mon Sep 17 00:00:00 2001
From: Hank Fan <hank.fan@tymphany.com>
Date: Tue, 17 Nov 2026 14:52:38 +0000
Subject: [PATCH BlueZ] audio/avrcp: allow early VOLUME_CHANGED register

RegisterNotification for EVENT_VOLUME_CHANGED rejected with Invalid
Parameter when media_transport_get_a2dp_volume() was still < 0. AVRCP
Absolute Volume CTs often register as soon as AVCTP is up; seed the
volume to 127 (same as target_init) and return Interim.

Assisted-by: Cursor:Composer
Link: https://github.com/bluez/bluez/pull/2841
---
 profiles/audio/avrcp.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 2f214e982..8df5685d8 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -1649,8 +1649,15 @@ static uint8_t avrcp_handle_register_notification(struct avrcp *session,
 break;
 case AVRCP_EVENT_VOLUME_CHANGED:
 volume = media_transport_get_a2dp_volume(dev);
-if (volume < 0)
-goto err;
+/*
+ * CT may RegisterNotification(VOLUME_CHANGED) before the
+ * A2DP transport exists. Rejecting with Invalid Parameter
+ * breaks Absolute Volume; seed max like target_init does.
+ */
+if (volume < 0) {
+media_transport_set_a2dp_volume(dev, 127);
+volume = 127;
+}

 pdu->params[1] = volume;
 len = 2;
--
2.53.0


________________________________

The information contained in this transmission may contain privileged and confidential information. It is intended only for the use of the person(s) named above. If you are not the intended recipient, you are hereby notified that any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

±¾à]¼þ(º¬ËùÓи½¼þ)°üº¬ÊÜ·¨Âɱ£×oÒÔ¼°™CÃÜÖ®ÙYӍ£¬ƒH¹©±¾à]¼þÖ¸¶¨µÄÊÕ¼þÈËʹÓá£Èç¹ûÄúK·ÇÖ¸¶¨µÄÊÕ¼þÈË£¬ÕˆÁ¢¼´ÒÔëŠ×Óà]¼þ֪ͨ¼Ä¼þÈË£¬KŒ¢±¾à]¼þ¼°ËùÓÐÑ}Ó¡±¾„h³ý¡£Õˆ×¢Ò⣬·Ç½›Êڙ࣬‡À¸ñ½ûÖ¹é†Ó[¡¢É¢²¥¡¢É¢Ñ»òÑ}Ñu±¾à]¼þ¼°ÆäƒÈÈÝ¡£

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-18  2:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18  2:26 [PATCH BlueZ] audio/avrcp: allow early VOLUME_CHANGED register Hank Fan (凡航)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox