From: Simon Mikuda <simon.mikuda@streamunlimited.com>
To: linux-bluetooth@vger.kernel.org
Cc: Simon Mikuda <simon.mikuda@streamunlimited.com>
Subject: [PATCH BlueZ 5/8] avrcp: Fix not browsing a player addressed before it was listed
Date: Sun, 22 Nov 2026 11:57:28 +0100 [thread overview]
Message-ID: <20261122105731.799090-6-simon.mikuda@streamunlimited.com> (raw)
In-Reply-To: <20261122105731.799090-1-simon.mikuda@streamunlimited.com>
SetBrowsedPlayer is sent for a browsable player from the player list
only if the player is addressed. But ADDRESSED_PLAYER_CHANGED does not
mark the player addressed when its id is already the id of the current
player: the player 0 of a target that has no player at connection, or
a player whose id was taken from the player list. Neither that
notification nor the SetAddressedPlayer response sends SetBrowsedPlayer,
so the player never gets the MediaFolder1 interface.
To reproduce, connect AVRCP to a target without a player, then register
a browsable player on the target. The controller gets the player from
the list as browsable, but never browses it:
btmon: EventID: 0x0a (EVENT_AVAILABLE_PLAYERS_CHANGED)
btmon: AVRCP: GetFolderItems: len 0x000a
btmon: Scope: 0x00 (Media Player List)
btmon: AVRCP: GetFolderItems: len 0x003a
btmon: PlayerID: 0x0001 (1)
btmon: Browsing
btmon: Name: BlueZ Browsable Player
bluetoothd: profiles/audio/player.c:media_player_set_browsable() true
media_player_set_name() BlueZ Browsable Player
and no SetBrowsedPlayer follows.
Mark the player addressed also in that case, and send SetBrowsedPlayer
once the player is addressed.
Fixes: 39a62aaa29b8 ("audio/avrcp: Don't send SetBrowsedPlayer if player is not browsable")
Assisted-by: Claude:claude-opus-5-5
---
profiles/audio/avrcp.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index fbd212511..128d7fe39 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -344,6 +344,8 @@ static const uint32_t company_ids[] = {
static void avrcp_register_notification(struct avrcp *session, uint8_t event);
static GList *player_list_settings(struct avrcp_player *player);
static void avrcp_get_play_status(struct avrcp *session);
+static void set_browsed_player(struct avrcp *session,
+ struct avrcp_player *player);
static void avrcp_browsing_record(sdp_record_t *record, sdp_data_t *version)
{
@@ -3063,10 +3065,11 @@ static gboolean avrcp_set_addressed_player_rsp(struct avctp *conn, uint8_t code,
if (!operands || code != AVC_CTYPE_ACCEPTED)
return FALSE;
- if (!avrcp_pull_header(&iov))
+ if (!avrcp_pull_header(&iov) || player->addressed)
return FALSE;
player->addressed = true;
+ set_browsed_player(session, player);
return FALSE;
}
@@ -3990,8 +3993,15 @@ static void avrcp_addressed_player_changed(struct avrcp *session,
struct avrcp_player *player = session->controller->player;
uint16_t id = get_be16(&pdu->params[1]);
- if (player != NULL && player->id == id)
+ if (player != NULL && player->id == id) {
+ /* SetBrowsedPlayer is sent once the player is addressed */
+ if (!player->addressed) {
+ player->addressed = true;
+ set_browsed_player(session, player);
+ }
+
return;
+ }
player = find_ct_player(session, id);
if (player == NULL) {
--
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 ` [PATCH BlueZ 4/8] avrcp: Fix byte order of TRACK_CHANGED identifier Simon Mikuda
2026-11-22 10:57 ` Simon Mikuda [this message]
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-6-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