From 5de753cbc0271d3905b93b30194116cc9c40d60c66f4622a7c0bfb31ceb3c647 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sat, 3 Apr 2021 13:30:58 +0000 Subject: [PATCH] Accepting request 882472 from home:acho:branches:Base:System Fix Bluetooth headphones disconnect periodically.bsc#1183821 OBS-URL: https://build.opensuse.org/request/show/882472 OBS-URL: https://build.opensuse.org/package/show/Base:System/bluez?expand=0&rev=304 --- ...ng-all-remote-SEPs-when-loading-from.patch | 43 +++++++++++++++++++ bluez.changes | 6 +++ bluez.spec | 1 + 3 files changed, 50 insertions(+) create mode 100644 bluez-avdtp-Fix-removing-all-remote-SEPs-when-loading-from.patch diff --git a/bluez-avdtp-Fix-removing-all-remote-SEPs-when-loading-from.patch b/bluez-avdtp-Fix-removing-all-remote-SEPs-when-loading-from.patch new file mode 100644 index 0000000..950958b --- /dev/null +++ b/bluez-avdtp-Fix-removing-all-remote-SEPs-when-loading-from.patch @@ -0,0 +1,43 @@ +From 28ddec8d6b829e002fa268c07b71e4c564ba9e16 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Thu, 11 Mar 2021 07:36:07 -0800 +Subject: [PATCH] avdtp: Fix removing all remote SEPs when loading from cache + +If avdtp_discover is called after cache has been loaded it end up +removing all remote SEPs as they have not been discovered yet. + +Fixes: https://github.com/bluez/bluez/issues/102 +--- + profiles/audio/avdtp.c | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c +index 088ca58b3..1d5871c62 100644 +--- a/profiles/audio/avdtp.c ++++ b/profiles/audio/avdtp.c +@@ -3381,10 +3381,18 @@ int avdtp_discover(struct avdtp *session, avdtp_discover_cb_t cb, + session->discover = g_new0(struct discover_callback, 1); + + if (session->seps) { +- session->discover->cb = cb; +- session->discover->user_data = user_data; +- session->discover->id = g_idle_add(process_discover, session); +- return 0; ++ struct avdtp_remote_sep *sep = session->seps->data; ++ ++ /* Check that SEP have been discovered as it may be loaded from ++ * cache. ++ */ ++ if (sep->discovered) { ++ session->discover->cb = cb; ++ session->discover->user_data = user_data; ++ session->discover->id = g_idle_add(process_discover, ++ session); ++ return 0; ++ } + } + + err = send_request(session, FALSE, NULL, AVDTP_DISCOVER, NULL, 0); +-- +2.30.2 + diff --git a/bluez.changes b/bluez.changes index 0a1dd8c..72c0c13 100644 --- a/bluez.changes +++ b/bluez.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Apr 1 04:27:37 UTC 2021 - Al Cho + +- add bluez-avdtp-Fix-removing-all-remote-SEPs-when-loading-from.patch + Fix Bluetooth headphones disconnect periodically(bsc#1183821) + ------------------------------------------------------------------- Wed Feb 24 20:25:23 UTC 2021 - Stefan Seyfried diff --git a/bluez.spec b/bluez.spec index c3b65d0..301ee96 100644 --- a/bluez.spec +++ b/bluez.spec @@ -49,6 +49,7 @@ Patch4: bluez-disable-broken-tests.diff Patch5: bluez-test-2to3.diff # Move 43xx firmware path for RPi3 bluetooth support bsc#1140688 Patch10: RPi-Move-the-43xx-firmware-into-lib-firmware.patch +Patch11: bluez-avdtp-Fix-removing-all-remote-SEPs-when-loading-from.patch # Upstream suggests to use btmon instead of hcidump and does not want those patches # => PATCH-FIX-OPENSUSE for those two :-) # fix some memory leak with malformed packet (reported upstream but not yet fixed)