From 60b4b5356dfec2229b4c3df8bcc3feab075d3d3d Mon Sep 17 00:00:00 2001 From: Hank Fan 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. 本郵件(含所有附件)包含受法律保護以及機密之資訊,僅供本郵件指定的收件人使用。如果您並非指定的收件人,請立即以電子郵件通知寄件人,並將本郵件及所有複印本刪除。請注意,非經授權,嚴格禁止閱覽、散播、散佈或複製本郵件及其內容。