From: Simon Mikuda <simon.mikuda@streamunlimited.com>
To: linux-bluetooth@vger.kernel.org
Cc: Simon Mikuda <simon.mikuda@streamunlimited.com>
Subject: [PATCH BlueZ 7/8] player: Fix missing Name of listed Now Playing items
Date: Sun, 22 Nov 2026 11:57:30 +0100 [thread overview]
Message-ID: <20261122105731.799090-8-simon.mikuda@streamunlimited.com> (raw)
In-Reply-To: <20261122105731.799090-1-simon.mikuda@streamunlimited.com>
A track change creates the Now Playing item of the new track by its UID
alone, without a name. When the folder is listed afterwards,
media_folder_create_item() finds that item by its UID and returns it as
it is, so the current track, and any track played before, are listed
without a Name.
To reproduce, browse a target with a Now Playing list, change the track
to one of its items, and list Now Playing:
btmon: AVRCP: GetItemAttributes: len 0x000c
btmon: Scope: 0x03 (Now Playing)
btmon: UID: 0x0000000000000002 (2)
bluetoothd: profiles/audio/player.c:media_player_set_playlist_item() 2
media_folder_create_item() (null) type audio uid 2
...
btmon: AVRCP: GetFolderItems: len 0x00e5
btmon: Name: Blue Morning
btmon: Name: Green Afternoon
media_folder_create_item() Blue Morning type audio uid 1
avrcp_list_items_rsp() start 0 end 1 items 2 total 2
Item 2, "Green Afternoon", the current track, is listed without a Name.
Set the name of an existing item when it is listed.
Fixes: b18723a18e8f ("audio/player: Create item on media_player_set_playlist_item")
Assisted-by: Claude:claude-opus-5-5
---
profiles/audio/player.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index 574a026ac..d4dbe1b59 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -1876,6 +1876,18 @@ void media_item_set_playable(struct media_item *item, bool value)
MEDIA_ITEM_INTERFACE, "Playable");
}
+static void media_item_set_name(struct media_item *item, const char *name)
+{
+ if (name == NULL || g_strcmp0(item->name, name) == 0)
+ return;
+
+ g_free(item->name);
+ item->name = g_strdup(name);
+
+ g_dbus_emit_property_changed(btd_get_dbus_connection(), item->path,
+ MEDIA_ITEM_INTERFACE, "Name");
+}
+
static struct media_item *media_folder_create_item(struct media_player *mp,
struct media_folder *folder,
const char *name,
@@ -1886,8 +1898,14 @@ static struct media_item *media_folder_create_item(struct media_player *mp,
const char *strtype;
item = media_folder_find_item(folder, uid);
- if (item != NULL)
+ if (item != NULL) {
+ /*
+ * The item may have been created by
+ * media_player_set_playlist_item(), which has no name for it.
+ */
+ media_item_set_name(item, name);
return item;
+ }
strtype = type_to_string(type);
if (strtype == 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 ` [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 ` Simon Mikuda [this message]
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-8-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