From: Simon Mikuda <simon.mikuda@streamunlimited.com>
To: linux-bluetooth@vger.kernel.org
Cc: Simon Mikuda <simon.mikuda@streamunlimited.com>
Subject: [PATCH BlueZ 4/8] avrcp: Fix byte order of TRACK_CHANGED identifier
Date: Sun, 22 Nov 2026 11:57:27 +0100 [thread overview]
Message-ID: <20261122105731.799090-5-simon.mikuda@streamunlimited.com> (raw)
In-Reply-To: <20261122105731.799090-1-simon.mikuda@streamunlimited.com>
The Identifier of TRACK_CHANGED, in the interim and the changed
response, was copied in host byte order. The identifiers sent so far, 0
and UINT64_MAX, read the same in either byte order, but any other one,
such as the UID of an item of a browsable player, is swapped on a
little endian host, and the controller then asks for an item that does
not exist.
To reproduce, with a target that reports the UID of the current track,
as "avrcp: Add browsing support in the target role" later in this
series does, change the track to the item of UID 2:
btmon: EventID: 0x02 (EVENT_TRACK_CHANGED)
btmon: Identifier: 0x 200000000000000 (144115188075855872)
btmon: AVRCP: GetItemAttributes: len 0x000c
btmon: UID: 0x0200000000000000 (144115188075855872)
btmon: AVRCP: GetItemAttributes: len 0x0001
btmon: Status: 0x09 (Does Not Exist)
Fixes: 9ab125a8ec20 ("AVRCP: Use track's UID in event notification")
Assisted-by: Claude:claude-opus-5-5
---
profiles/audio/avrcp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index aff1c381a..fbd212511 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -791,7 +791,7 @@ void avrcp_player_event(struct avrcp_player *player, uint8_t id,
break;
case AVRCP_EVENT_TRACK_CHANGED:
size = 9;
- memcpy(&pdu->params[1], data, sizeof(uint64_t));
+ put_be64(*(const uint64_t *) data, &pdu->params[1]);
break;
case AVRCP_EVENT_TRACK_REACHED_END:
@@ -1629,7 +1629,7 @@ static uint8_t avrcp_handle_register_notification(struct avrcp *session,
case AVRCP_EVENT_TRACK_CHANGED:
len = 9;
uid = player_get_uid(player);
- memcpy(&pdu->params[1], &uid, sizeof(uint64_t));
+ put_be64(uid, &pdu->params[1]);
break;
case AVRCP_EVENT_TRACK_REACHED_END:
--
2.43.0
next prev parent reply other threads:[~2026-11-22 10:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 10:57 [PATCH BlueZ 0/8] AVRCP browsing fixes, and browsing and cover art in the target role Simon Mikuda
2026-11-22 10:57 ` [PATCH BlueZ 1/8] avrcp: Fix not checking browsing PDU parameter length Simon Mikuda
2026-11-22 18:57 ` AVRCP browsing fixes, and browsing and cover art in the target role bluez.test.bot
2026-11-22 10:57 ` [PATCH BlueZ 2/8] avrcp: Fix listing media players up to item 0xffffffff Simon Mikuda
2026-11-22 10:57 ` [PATCH BlueZ 3/8] avrcp: Fix byte order of ADDRESSED_PLAYER_CHANGED notification Simon Mikuda
2026-11-22 10:57 ` Simon Mikuda [this message]
2026-11-22 10:57 ` [PATCH BlueZ 5/8] avrcp: Fix not browsing a player addressed before it was listed Simon Mikuda
2026-11-22 10:57 ` [PATCH BlueZ 6/8] player: Fix crash on Search in a folder with a space in its name Simon Mikuda
2026-11-22 10:57 ` [PATCH BlueZ 7/8] player: Fix missing Name of listed Now Playing items Simon Mikuda
2026-11-22 10:57 ` [PATCH BlueZ 8/8] player: Fix NumberOfItems of Now Playing after its content changed Simon Mikuda
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=20261122105731.799090-5-simon.mikuda@streamunlimited.com \
--to=simon.mikuda@streamunlimited.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox