All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hank Fan (凡航)" <Hank.Fan@tymphany.com>
To: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Cc: "Hank Fan (凡航)" <Hank.Fan@tymphany.com>
Subject: [PATCH BlueZ] audio/avrcp: allow early VOLUME_CHANGED register
Date: Wed, 18 Nov 2026 02:26:42 +0000	[thread overview]
Message-ID: <8ddc3991712943d8bb45bb4512075ea7@tymphany.com> (raw)

[-- 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±¾à]¼þ¼°ÆäƒÈÈÝ¡£

                 reply	other threads:[~2026-11-18  2:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ddc3991712943d8bb45bb4512075ea7@tymphany.com \
    --to=hank.fan@tymphany.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.