Skip to contentSkip to conversation

a2dp: Handle remote SEP disappearing

PATCH In review Luiz Augusto von Dentz 2 participants 3 messages Jan 21, 2021 – Jan 22, 2021 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 a2dp: Handle remote SEP disappearing

From: Luiz Augusto von Dentz <[email protected]>

Some devices (Sony WH-1000XM4) seems to dinamically change its endpoints depending on the configuration which may leave behind endpoints loaded from cache that are no longer valid.

gh-issue: https://github.com/bluez/bluez/issues/85

---
 profiles/audio/a2dp.c  | 12 +++++++++
 profiles/audio/avdtp.c | 55 +++++++++++++++++++++++++++++++++++-------
 profiles/audio/avdtp.h |  5 ++++
 3 files changed, 63 insertions(+), 9 deletions(-)
profiles/audio/a2dp.c +12 -0
index a333276e0..624d0d42d 100644
@@ -1488,6 +1488,8 @@ static void remote_sep_free(void *data)
 {
 	struct a2dp_remote_sep *sep = data;
 
+	avdtp_remote_sep_set_destroy(sep->sep, NULL, NULL);
+
 	free(sep->path);
 	free(sep);
 }
@@ -1874,6 +1876,14 @@ static const GDBusPropertyTable sep_properties[] = {
 	{ }
 };
 
+static void remote_sep_destroy(void *user_data)
+{
+	struct a2dp_remote_sep *sep = user_data;
+
+	if (queue_remove(sep->chan->seps, sep))
+		remove_remote_sep(sep);
+}
+
 static void register_remote_sep(void *data, void *user_data)
 {
 	struct avdtp_remote_sep *rsep = data;
@@ -1910,6 +1920,8 @@ static void register_remote_sep(void *data, void *user_data)
 
 	DBG("Found remote SEP: %s", sep->path);
 
+	avdtp_remote_sep_set_destroy(rsep, sep, remote_sep_destroy);
+
 done:
 	queue_push_tail(chan->seps, sep);
 }
profiles/audio/avdtp.c +46 -9

100 lines not on this page · raw message

profiles/audio/avdtp.h +5 -0
index 7a1c109c2..b29d0621a 100644
@@ -216,6 +216,11 @@ struct avdtp_remote_sep *avdtp_register_remote_sep(struct avdtp *session,
 							GSList *caps,
 							bool delay_reporting);
 
+typedef void (*avdtp_remote_sep_destroy_t)(void *user_data);
+
+void avdtp_remote_sep_set_destroy(struct avdtp_remote_sep *sep, void *user_data,
+					avdtp_remote_sep_destroy_t destroy);
+
 uint8_t avdtp_get_seid(struct avdtp_remote_sep *sep);
 
 uint8_t avdtp_get_type(struct avdtp_remote_sep *sep);
Signature · 1 line
2.26.2
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=418663

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS

---
Regards,
Linux Bluetooth

author maintainer
#2 lore raw

Hi,

Quoted 20 lines · On Wed, Jan 20, 2021 at 5:59 PM <[email protected]> wrote:

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=418663

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

Quoted 8 lines

##############################
Test: MakeCheck - PASS

---
Regards,
Linux Bluetooth

Pushed.

Signature · 1 line
Luiz Augusto von Dentz