Merge ~dirksu/bluez:noble into ~bluetooth/bluez:noble

Proposed by Dirk Su
Status: Merged
Merged at revision: 797e9fad3cc90ba25de49a49f967bb17a300ee70
Proposed branch: ~dirksu/bluez:noble
Merge into: ~bluetooth/bluez:noble
Diff against target: 266 lines (+232/-0)
5 files modified
debian/changelog (+9/-0)
debian/patches/audio-upgrade-versions-to-latest-possible-to-qualify.patch (+92/-0)
debian/patches/cleanup-endpoints-when-devices-been-removed.patch (+18/-0)
debian/patches/profiles-avdtp-Fix-reply-for-bad-media-transport-for.patch (+110/-0)
debian/patches/series (+3/-0)
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Review via email: mp+492286@code.launchpad.net

Commit message

Add upstream patches to improve audio profiles compatibility

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 9ce0896..7dbb1bd 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,12 @@
6+bluez (5.72-0ubuntu5.5) noble; urgency=medium
7+
8+ * Improve audio profiles compatibility (LP: #2122382)
9+ d/patches: audio-upgrade-versions-to-latest-possible-to-qualify.patch
10+ d/patches: cleanup-endpoints-when-devices-been-removed.patch
11+ d/patches: profiles-avdtp-Fix-reply-for-bad-media-transport-for.patch
12+
13+ -- Dirk Su <dirk.su@canonical.com> Wed, 10 Sep 2025 10:48:36 +0800
14+
15 bluez (5.72-0ubuntu5.4) noble; urgency=medium
16
17 [ Andreas Glinserer ]
18diff --git a/debian/patches/audio-upgrade-versions-to-latest-possible-to-qualify.patch b/debian/patches/audio-upgrade-versions-to-latest-possible-to-qualify.patch
19new file mode 100644
20index 0000000..723d411
21--- /dev/null
22+++ b/debian/patches/audio-upgrade-versions-to-latest-possible-to-qualify.patch
23@@ -0,0 +1,92 @@
24+From 47c90fbea826499ca5df110746f0d1ce443e9ef1 Mon Sep 17 00:00:00 2001
25+From: Raghavender Reddy Bujala <quic_rbujala@quicinc.com>
26+Date: Wed, 12 Feb 2025 14:35:53 +0530
27+Subject: [PATCH] audio: upgrade versions to latest possible to qualify
28+
29+Most of the existing profile versions are withdrawn
30+to make PTS successfull, need to upgrade the version
31+for audio profiles and there are no mandatory feature
32+changes between these versions are seen.
33+
34+Version changes
35+A2DP from 1.3 to 1.4
36+HFP from 1.7 to 1.8
37+AVRCP TG from 1.5 to 1.6
38+AVCTP from 1.3 to 1.4
39+
40+Bug-Ubuntu: https://bugs.launchpad.net/bugs/2122382
41+---
42+ profiles/audio/a2dp.c | 2 +-
43+ profiles/audio/avrcp.c | 6 +++---
44+ src/profile.c | 4 ++--
45+ 3 files changed, 6 insertions(+), 6 deletions(-)
46+
47+diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
48+index b43161a..d8885eb 100644
49+--- a/profiles/audio/a2dp.c
50++++ b/profiles/audio/a2dp.c
51+@@ -1581,7 +1581,7 @@ static sdp_record_t *a2dp_record(uint8_t type)
52+ sdp_record_t *record;
53+ sdp_data_t *psm, *version, *features;
54+ uint16_t lp = AVDTP_UUID;
55+- uint16_t a2dp_ver = 0x0103, avdtp_ver = 0x0103, feat = 0x000f;
56++ uint16_t a2dp_ver = 0x0104, avdtp_ver = 0x0103, feat = 0x000f;
57+
58+ record = sdp_record_alloc();
59+ if (!record)
60+diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
61+index dda9a30..def175f 100644
62+--- a/profiles/audio/avrcp.c
63++++ b/profiles/audio/avrcp.c
64+@@ -131,7 +131,7 @@
65+
66+ #define AVRCP_BROWSING_TIMEOUT 1
67+ #define AVRCP_CT_VERSION 0x0106
68+-#define AVRCP_TG_VERSION 0x0105
69++#define AVRCP_TG_VERSION 0x0106
70+
71+ #define AVRCP_SCOPE_MEDIA_PLAYER_LIST 0x00
72+ #define AVRCP_SCOPE_MEDIA_PLAYER_VFS 0x01
73+@@ -406,7 +406,7 @@ static sdp_record_t *avrcp_ct_record(bool browsing)
74+ sdp_record_t *record;
75+ sdp_data_t *psm[2], *version, *features;
76+ uint16_t lp = AVCTP_CONTROL_PSM;
77+- uint16_t avctp_ver = 0x0103;
78++ uint16_t avctp_ver = 0x0104;
79+ uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
80+ AVRCP_FEATURE_CATEGORY_2 |
81+ AVRCP_FEATURE_CATEGORY_3 |
82+@@ -482,7 +482,7 @@ static sdp_record_t *avrcp_tg_record(bool browsing)
83+ sdp_record_t *record;
84+ sdp_data_t *psm_control, *version, *features;
85+ uint16_t lp = AVCTP_CONTROL_PSM;
86+- uint16_t avctp_ver = 0x0103;
87++ uint16_t avctp_ver = 0x0104;
88+ uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
89+ AVRCP_FEATURE_CATEGORY_2 |
90+ AVRCP_FEATURE_CATEGORY_3 |
91+diff --git a/src/profile.c b/src/profile.c
92+index ea188f3..af03dbb 100644
93+--- a/src/profile.c
94++++ b/src/profile.c
95+@@ -2069,7 +2069,7 @@ static struct default_settings {
96+ .authorize = true,
97+ .auto_connect = true,
98+ .get_record = get_hfp_hf_record,
99+- .version = 0x0107,
100++ .version = 0x0108,
101+ }, {
102+ .uuid = HSP_HS_UUID,
103+ .name = "Headset unit",
104+@@ -2089,7 +2089,7 @@ static struct default_settings {
105+ .authorize = true,
106+ .auto_connect = true,
107+ .get_record = get_hfp_ag_record,
108+- .version = 0x0107,
109++ .version = 0x0108,
110+ /* HFP 1.7.2: By default features bitfield is 0b001001 */
111+ .features = 0x09,
112+ }, {
113+--
114+2.43.0
115+
116diff --git a/debian/patches/cleanup-endpoints-when-devices-been-removed.patch b/debian/patches/cleanup-endpoints-when-devices-been-removed.patch
117new file mode 100644
118index 0000000..00400a7
119--- /dev/null
120+++ b/debian/patches/cleanup-endpoints-when-devices-been-removed.patch
121@@ -0,0 +1,18 @@
122+Description: Cleanup endpoints when device been removed
123+ This patch merge two upstream commit
124+ https://github.com/bluez/bluez/commit/ea3f4047e452b081e34d017cce316aba9d623301
125+ https://github.com/bluez/bluez/commit/78aabd896dbe3e23faaebbc97b8ecd711b2502fc
126+Bug-Ubuntu: https://bugs.launchpad.net/bugs/2122382
127+---
128+Index: bluez-5.72/src/device.c
129+===================================================================
130+--- bluez-5.72.orig/src/device.c 2025-09-16 16:02:14.000000000 +0800
131++++ bluez-5.72/src/device.c 2025-09-16 16:03:12.615527575 +0800
132+@@ -4645,6 +4645,7 @@
133+ }
134+ g_key_file_remove_group(key_file, "ServiceRecords", NULL);
135+ g_key_file_remove_group(key_file, "Attributes", NULL);
136++ g_key_file_remove_group(key_file, "Endpoints", NULL);
137+
138+ data = g_key_file_to_data(key_file, &length, NULL);
139+ if (length > 0) {
140diff --git a/debian/patches/profiles-avdtp-Fix-reply-for-bad-media-transport-for.patch b/debian/patches/profiles-avdtp-Fix-reply-for-bad-media-transport-for.patch
141new file mode 100644
142index 0000000..6a5f48f
143--- /dev/null
144+++ b/debian/patches/profiles-avdtp-Fix-reply-for-bad-media-transport-for.patch
145@@ -0,0 +1,110 @@
146+From f2120e3ded0656c8eda3d8058ee35654aba3fd09 Mon Sep 17 00:00:00 2001
147+From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= <frederic.danis@collabora.com>
148+Date: Wed, 26 Mar 2025 10:07:11 +0100
149+Subject: [PATCH] profiles/avdtp: Fix reply for bad media transport format
150+
151+Currently the avdtp_setconf_cmd() fails to check the capability length
152+of the Media Transport Service Category, which should be 0, because
153+caps_to_list() doesn't add it to the list of services as it should
154+be bigger than packet boundary.
155+
156+This commit adds an &err parameter to caps_to_list() and set the error
157+to AVDTP_BAD_MEDIA_TRANSPORT_FORMAT if Media Transport capability as
158+invalid length.
159+
160+This is required for passing AVDTP/SNK/ACP/TRA/BTR/BI-01-C PTS test
161+case:
162+To verify that the IUT (ACP) is able to issue a set configuration
163+reject response to the INT if the format of the media transport is
164+incorrect.
165+
166+Bug-Ubuntu: https://bugs.launchpad.net/bugs/2122382
167+---
168+ profiles/audio/avdtp.c | 35 ++++++++++++++++++++---------------
169+ 1 file changed, 20 insertions(+), 15 deletions(-)
170+
171+diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
172+index 80fbe847e..dd8458f20 100644
173+--- a/profiles/audio/avdtp.c
174++++ b/profiles/audio/avdtp.c
175+@@ -1312,7 +1312,8 @@ struct avdtp_remote_sep *avdtp_find_remote_sep(struct avdtp *session,
176+
177+ static GSList *caps_to_list(uint8_t *data, size_t size,
178+ struct avdtp_service_capability **codec,
179+- gboolean *delay_reporting)
180++ gboolean *delay_reporting,
181++ uint8_t *err)
182+ {
183+ struct avdtp_service_capability *cap;
184+ GSList *caps;
185+@@ -1328,6 +1329,17 @@ static GSList *caps_to_list(uint8_t *data, size_t size,
186+
187+ cap = (struct avdtp_service_capability *)data;
188+
189++ /* Verify that the Media Transport capability's length = 0.
190++ * Reject otherwise
191++ */
192++ if (cap->category == AVDTP_MEDIA_TRANSPORT &&
193++ cap->length != 0) {
194++ error("Invalid media transport in getcap resp");
195++ if (err)
196++ *err = AVDTP_BAD_MEDIA_TRANSPORT_FORMAT;
197++ break;
198++ }
199++
200+ if (sizeof(*cap) + cap->length > size) {
201+ error("Invalid capability data in getcap resp");
202+ break;
203+@@ -1494,9 +1506,8 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session, uint8_t transaction,
204+ struct conf_rej rej;
205+ struct avdtp_local_sep *sep;
206+ struct avdtp_stream *stream;
207+- uint8_t err, category = 0x00;
208++ uint8_t err = 0, category = 0x00;
209+ struct btd_service *service;
210+- GSList *l;
211+
212+ if (size < sizeof(struct setconf_req)) {
213+ error("Too short getcap request");
214+@@ -1552,7 +1563,10 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session, uint8_t transaction,
215+ stream->caps = caps_to_list(req->caps,
216+ size - sizeof(struct setconf_req),
217+ &stream->codec,
218+- &stream->delay_reporting);
219++ &stream->delay_reporting,
220++ &err);
221++ if (err)
222++ goto failed_stream;
223+
224+ if (!stream->caps || !stream->codec) {
225+ err = AVDTP_UNSUPPORTED_CONFIGURATION;
226+@@ -1560,16 +1574,6 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session, uint8_t transaction,
227+ goto failed_stream;
228+ }
229+
230+- /* Verify that the Media Transport capability's length = 0. Reject otherwise */
231+- for (l = stream->caps; l != NULL; l = g_slist_next(l)) {
232+- struct avdtp_service_capability *cap = l->data;
233+-
234+- if (cap->category == AVDTP_MEDIA_TRANSPORT && cap->length != 0) {
235+- err = AVDTP_BAD_MEDIA_TRANSPORT_FORMAT;
236+- goto failed_stream;
237+- }
238+- }
239+-
240+ if (stream->delay_reporting && session->version < 0x0103)
241+ session->version = 0x0103;
242+
243+@@ -2827,7 +2831,8 @@ static gboolean avdtp_get_capabilities_resp(struct avdtp *session,
244+ }
245+
246+ sep->caps = caps_to_list(resp->caps, size - sizeof(struct getcap_resp),
247+- &sep->codec, &sep->delay_reporting);
248++ &sep->codec, &sep->delay_reporting,
249++ NULL);
250+
251+ return TRUE;
252+ }
253+--
254+2.43.0
255+
256diff --git a/debian/patches/series b/debian/patches/series
257index 94c8b4c..176b343 100644
258--- a/debian/patches/series
259+++ b/debian/patches/series
260@@ -26,3 +26,6 @@ raspi-cypress-305-bdaddr.patch
261 git-reconnect-fix.patch
262 reconnect-hsp-on-a2dp-reconnect.patch
263 device-Fix-Pair-method-not-setting-auto_connect.patch
264+profiles-avdtp-Fix-reply-for-bad-media-transport-for.patch
265+cleanup-endpoints-when-devices-been-removed.patch
266+audio-upgrade-versions-to-latest-possible-to-qualify.patch

Subscribers

People subscribed via source and target branches

to all changes: