* Bluez stopped connecting A2DP sink @ 2019-10-07 19:30 yayfortrees 2019-10-08 10:24 ` Luiz Augusto von Dentz 0 siblings, 1 reply; 6+ messages in thread From: yayfortrees @ 2019-10-07 19:30 UTC (permalink / raw) To: linux-bluetooth Hello, I recently upgraded bluez to 5.51 from 5.50 and my headphones stopped using the A2DP sink during autoconnect. The headphones instead go to HSP/HFP mode and the A2DP sink is disabled in pavucontrol/pactl. The A2DP sink will only work when the device is initially paired. This had worked flawlessly for years. I was able to track down the regression to this patch: https://www.spinics.net/lists/linux-bluetooth/msg76180.html ([PATCH BlueZ] policy: Add logic to connect a Sink). If I apply the patch to 5.50, my headphones no longer connect to the A2DP sink, if I remove it the problem goes away. Not sure what else I should include to help track this down. The headphones I'm using are Beats Wireless (Solo Bluetooth). The only relevant log entry I see with the patch applied is: a2dp-sink profile connect failed for 34:DF:2A:0D:F8:C2: Device or resource busy Let me know if any other information is needed. Thanks. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bluez stopped connecting A2DP sink 2019-10-07 19:30 Bluez stopped connecting A2DP sink yayfortrees @ 2019-10-08 10:24 ` Luiz Augusto von Dentz [not found] ` <CAJ0=ZJ1pD4dHZe98eZnZ6R-ZBazGip_mrPVV_XjFgThXM0Ebmg@mail.gmail.com> 0 siblings, 1 reply; 6+ messages in thread From: Luiz Augusto von Dentz @ 2019-10-08 10:24 UTC (permalink / raw) To: yayfortrees; +Cc: linux-bluetooth Hi, On Mon, Oct 7, 2019 at 10:34 PM yayfortrees <yayfortrees@gmail.com> wrote: > > Hello, > > I recently upgraded bluez to 5.51 from 5.50 and my headphones stopped > using the A2DP sink during autoconnect. The headphones instead go to > HSP/HFP mode and the A2DP sink is disabled in pavucontrol/pactl. The > A2DP sink will only work when the device is initially paired. > > This had worked flawlessly for years. I was able to track down the > regression to this patch: > https://www.spinics.net/lists/linux-bluetooth/msg76180.html ([PATCH > BlueZ] policy: Add logic to connect a Sink). If I apply the patch to > 5.50, my headphones no longer connect to the A2DP sink, if I remove it > the problem goes away. > > Not sure what else I should include to help track this down. The > headphones I'm using are Beats Wireless (Solo Bluetooth). > > The only relevant log entry I see with the patch applied is: > a2dp-sink profile connect failed for 34:DF:2A:0D:F8:C2: Device or resource busy Can you collect the HCI traces of the problem using btmon? I didn't expect that to cause any problems, it should in theory solve them but lets see. > Let me know if any other information is needed. > Thanks. -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAJ0=ZJ1pD4dHZe98eZnZ6R-ZBazGip_mrPVV_XjFgThXM0Ebmg@mail.gmail.com>]
* Re: Bluez stopped connecting A2DP sink [not found] ` <CAJ0=ZJ1pD4dHZe98eZnZ6R-ZBazGip_mrPVV_XjFgThXM0Ebmg@mail.gmail.com> @ 2019-10-09 7:51 ` Luiz Augusto von Dentz 2019-10-10 8:09 ` Luiz Augusto von Dentz 0 siblings, 1 reply; 6+ messages in thread From: Luiz Augusto von Dentz @ 2019-10-09 7:51 UTC (permalink / raw) To: yayfortrees; +Cc: linux-bluetooth Hi, On Wed, Oct 9, 2019 at 1:56 AM yayfortrees <yayfortrees@gmail.com> wrote: > > Hello, > > I've attached btmon traces for 5.50 and 5.51. Thanks for taking a look! > > Let me know if you need anything else. Must likely the following error has something to do with it: = bluetoothd: a2dp-sink profile connect failed for 34:DF:2A:0D:F8:C2: Device or resource busy I will check why this could be happening. > On Tue, Oct 8, 2019 at 4:24 AM Luiz Augusto von Dentz > <luiz.dentz@gmail.com> wrote: > > > > Hi, > > > > On Mon, Oct 7, 2019 at 10:34 PM yayfortrees <yayfortrees@gmail.com> wrote: > > > > > > Hello, > > > > > > I recently upgraded bluez to 5.51 from 5.50 and my headphones stopped > > > using the A2DP sink during autoconnect. The headphones instead go to > > > HSP/HFP mode and the A2DP sink is disabled in pavucontrol/pactl. The > > > A2DP sink will only work when the device is initially paired. > > > > > > This had worked flawlessly for years. I was able to track down the > > > regression to this patch: > > > https://www.spinics.net/lists/linux-bluetooth/msg76180.html ([PATCH > > > BlueZ] policy: Add logic to connect a Sink). If I apply the patch to > > > 5.50, my headphones no longer connect to the A2DP sink, if I remove it > > > the problem goes away. > > > > > > Not sure what else I should include to help track this down. The > > > headphones I'm using are Beats Wireless (Solo Bluetooth). > > > > > > The only relevant log entry I see with the patch applied is: > > > a2dp-sink profile connect failed for 34:DF:2A:0D:F8:C2: Device or resource busy > > > > Can you collect the HCI traces of the problem using btmon? I didn't > > expect that to cause any problems, it should in theory solve them but > > lets see. > > > > > Let me know if any other information is needed. > > > Thanks. > > > > > > > > -- > > Luiz Augusto von Dentz -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bluez stopped connecting A2DP sink 2019-10-09 7:51 ` Luiz Augusto von Dentz @ 2019-10-10 8:09 ` Luiz Augusto von Dentz [not found] ` <CAJ0=ZJ17vp_N-P2df6xzVON5yTr0U1v5jk7LTYfrgCpcu6kfBg@mail.gmail.com> 0 siblings, 1 reply; 6+ messages in thread From: Luiz Augusto von Dentz @ 2019-10-10 8:09 UTC (permalink / raw) To: yayfortrees; +Cc: linux-bluetooth Hi, On Wed, Oct 9, 2019 at 10:51 AM Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote: > > Hi, > > On Wed, Oct 9, 2019 at 1:56 AM yayfortrees <yayfortrees@gmail.com> wrote: > > > > Hello, > > > > I've attached btmon traces for 5.50 and 5.51. Thanks for taking a look! > > > > Let me know if you need anything else. > > Must likely the following error has something to do with it: > > = bluetoothd: a2dp-sink profile connect failed for 34:DF:2A:0D:F8:C2: > Device or resource busy > > I will check why this could be happening. I tried this one and couldn't reproduce with the headsets I have, could you please run bluetooth -dn and attach the logs here? > > On Tue, Oct 8, 2019 at 4:24 AM Luiz Augusto von Dentz > > <luiz.dentz@gmail.com> wrote: > > > > > > Hi, > > > > > > On Mon, Oct 7, 2019 at 10:34 PM yayfortrees <yayfortrees@gmail.com> wrote: > > > > > > > > Hello, > > > > > > > > I recently upgraded bluez to 5.51 from 5.50 and my headphones stopped > > > > using the A2DP sink during autoconnect. The headphones instead go to > > > > HSP/HFP mode and the A2DP sink is disabled in pavucontrol/pactl. The > > > > A2DP sink will only work when the device is initially paired. > > > > > > > > This had worked flawlessly for years. I was able to track down the > > > > regression to this patch: > > > > https://www.spinics.net/lists/linux-bluetooth/msg76180.html ([PATCH > > > > BlueZ] policy: Add logic to connect a Sink). If I apply the patch to > > > > 5.50, my headphones no longer connect to the A2DP sink, if I remove it > > > > the problem goes away. > > > > > > > > Not sure what else I should include to help track this down. The > > > > headphones I'm using are Beats Wireless (Solo Bluetooth). > > > > > > > > The only relevant log entry I see with the patch applied is: > > > > a2dp-sink profile connect failed for 34:DF:2A:0D:F8:C2: Device or resource busy > > > > > > Can you collect the HCI traces of the problem using btmon? I didn't > > > expect that to cause any problems, it should in theory solve them but > > > lets see. > > > > > > > Let me know if any other information is needed. > > > > Thanks. > > > > > > > > > > > > -- > > > Luiz Augusto von Dentz > > > > -- > Luiz Augusto von Dentz -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAJ0=ZJ17vp_N-P2df6xzVON5yTr0U1v5jk7LTYfrgCpcu6kfBg@mail.gmail.com>]
* Re: Bluez stopped connecting A2DP sink [not found] ` <CAJ0=ZJ17vp_N-P2df6xzVON5yTr0U1v5jk7LTYfrgCpcu6kfBg@mail.gmail.com> @ 2019-10-11 12:59 ` Luiz Augusto von Dentz 2019-10-11 17:48 ` yayfortrees 0 siblings, 1 reply; 6+ messages in thread From: Luiz Augusto von Dentz @ 2019-10-11 12:59 UTC (permalink / raw) To: yayfortrees; +Cc: linux-bluetooth [-- Attachment #1: Type: text/plain, Size: 3384 bytes --] Hi, On Thu, Oct 10, 2019 at 11:13 PM yayfortrees <yayfortrees@gmail.com> wrote: > > Hello, > > I've attached debug logs for 5.50 nopatch and 5.50 with the patch. > > To me it looked like it may be a timing issue - trying to connect the > a2dp sink too early. As an experiment I put a sleep(1) at the top of > the hs_cb function from your patch and the a2dp sink was connected. > With the sleep I still get the "Device or resource busy" error early > on, but it does reconnect the a2dp sink later in the connection and > things work. It's not consistent though, maybe 1 of 5 attempts would > fail to connect the a2dp profile. Try with the following patch. > I included that debug log as well. > > Hope this helps, thanks! > > On Thu, Oct 10, 2019 at 2:10 AM Luiz Augusto von Dentz > <luiz.dentz@gmail.com> wrote: > > > > Hi, > > > > On Wed, Oct 9, 2019 at 10:51 AM Luiz Augusto von Dentz > > <luiz.dentz@gmail.com> wrote: > > > > > > Hi, > > > > > > On Wed, Oct 9, 2019 at 1:56 AM yayfortrees <yayfortrees@gmail.com> wrote: > > > > > > > > Hello, > > > > > > > > I've attached btmon traces for 5.50 and 5.51. Thanks for taking a look! > > > > > > > > Let me know if you need anything else. > > > > > > Must likely the following error has something to do with it: > > > > > > = bluetoothd: a2dp-sink profile connect failed for 34:DF:2A:0D:F8:C2: > > > Device or resource busy > > > > > > I will check why this could be happening. > > > > I tried this one and couldn't reproduce with the headsets I have, > > could you please run bluetooth -dn and attach the logs here? > > > > > > On Tue, Oct 8, 2019 at 4:24 AM Luiz Augusto von Dentz > > > > <luiz.dentz@gmail.com> wrote: > > > > > > > > > > Hi, > > > > > > > > > > On Mon, Oct 7, 2019 at 10:34 PM yayfortrees <yayfortrees@gmail.com> wrote: > > > > > > > > > > > > Hello, > > > > > > > > > > > > I recently upgraded bluez to 5.51 from 5.50 and my headphones stopped > > > > > > using the A2DP sink during autoconnect. The headphones instead go to > > > > > > HSP/HFP mode and the A2DP sink is disabled in pavucontrol/pactl. The > > > > > > A2DP sink will only work when the device is initially paired. > > > > > > > > > > > > This had worked flawlessly for years. I was able to track down the > > > > > > regression to this patch: > > > > > > https://www.spinics.net/lists/linux-bluetooth/msg76180.html ([PATCH > > > > > > BlueZ] policy: Add logic to connect a Sink). If I apply the patch to > > > > > > 5.50, my headphones no longer connect to the A2DP sink, if I remove it > > > > > > the problem goes away. > > > > > > > > > > > > Not sure what else I should include to help track this down. The > > > > > > headphones I'm using are Beats Wireless (Solo Bluetooth). > > > > > > > > > > > > The only relevant log entry I see with the patch applied is: > > > > > > a2dp-sink profile connect failed for 34:DF:2A:0D:F8:C2: Device or resource busy > > > > > > > > > > Can you collect the HCI traces of the problem using btmon? I didn't > > > > > expect that to cause any problems, it should in theory solve them but > > > > > lets see. > > > > > > > > > > > Let me know if any other information is needed. > > > > > > Thanks. > > > > > > > > > > > > > > > > > > > > -- > > > > > Luiz Augusto von Dentz > > > > > > > > > > > > -- > > > Luiz Augusto von Dentz > > > > > > > > -- > > Luiz Augusto von Dentz -- Luiz Augusto von Dentz [-- Attachment #2: 0001-audio-Fix-cancelling-disconnect-timeout.patch --] [-- Type: text/x-patch, Size: 3060 bytes --] From 4bbd477cf6ac05aff73ee74f18a1a418b1c1af9f Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Date: Fri, 11 Oct 2019 15:40:04 +0300 Subject: [PATCH BlueZ] audio: Fix cancelling disconnect timeout If AVDTP session has been connected but no stream has been setup calls to service->connect would return -EBUSY to avoid stream setup collision but it also takes a reference to the session which cancelling the disconnect timeout and disabling the stream_setup logic that would attempt to estabilish a stream. --- profiles/audio/sink.c | 25 ++++++++++++------------- profiles/audio/source.c | 25 ++++++++++++------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c index 7cac21034..966440534 100644 --- a/profiles/audio/sink.c +++ b/profiles/audio/sink.c @@ -256,11 +256,18 @@ gboolean sink_setup_stream(struct btd_service *service, struct avdtp *session) if (sink->connect_id > 0 || sink->disconnect_id > 0) return FALSE; - if (session && !sink->session) - sink->session = avdtp_ref(session); - - if (!sink->session) - return FALSE; + if (!sink->session) { + if (session) + sink->session = avdtp_ref(session); + else + sink->session = a2dp_avdtp_get( + btd_service_get_device(service)); + + if (!sink->session) { + DBG("Unable to get a session"); + return FALSE; + } + } sink->connect_id = a2dp_discover(sink->session, discovery_complete, sink); @@ -274,14 +281,6 @@ int sink_connect(struct btd_service *service) { struct sink *sink = btd_service_get_user_data(service); - if (!sink->session) - sink->session = a2dp_avdtp_get(btd_service_get_device(service)); - - if (!sink->session) { - DBG("Unable to get a session"); - return -EIO; - } - if (sink->connect_id > 0 || sink->disconnect_id > 0) return -EBUSY; diff --git a/profiles/audio/source.c b/profiles/audio/source.c index 4081e1970..0ac20fe40 100644 --- a/profiles/audio/source.c +++ b/profiles/audio/source.c @@ -257,11 +257,18 @@ gboolean source_setup_stream(struct btd_service *service, if (source->connect_id > 0 || source->disconnect_id > 0) return FALSE; - if (session && !source->session) - source->session = avdtp_ref(session); - - if (!source->session) - return FALSE; + if (!source->session) { + if (session) + source->session = avdtp_ref(session); + else + source->session = a2dp_avdtp_get( + btd_service_get_device(service)); + + if (!source->session) { + DBG("Unable to get a session"); + return FALSE; + } + } source->connect_id = a2dp_discover(source->session, discovery_complete, source); @@ -275,14 +282,6 @@ int source_connect(struct btd_service *service) { struct source *source = btd_service_get_user_data(service); - if (!source->session) - source->session = a2dp_avdtp_get(btd_service_get_device(service)); - - if (!source->session) { - DBG("Unable to get a session"); - return -EIO; - } - if (source->connect_id > 0 || source->disconnect_id > 0) return -EBUSY; -- 2.21.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: Bluez stopped connecting A2DP sink 2019-10-11 12:59 ` Luiz Augusto von Dentz @ 2019-10-11 17:48 ` yayfortrees 0 siblings, 0 replies; 6+ messages in thread From: yayfortrees @ 2019-10-11 17:48 UTC (permalink / raw) To: Luiz Augusto von Dentz; +Cc: linux-bluetooth Hello, The patch works, I get the a2dp sink consistently through re-connects now. I am still seeing the a2dp-sink profile error in the logs, but other than that everything seems to be fine. bluetoothd[16493]: src/device.c:device_profile_connected() Headset Voice gateway Success (0) bluetoothd[16493]: plugins/policy.c:policy_connect() /org/bluez/hci0/dev_34_DF_2A_0D_F8_C2 profile a2dp-sink bluetoothd[16493]: profiles/audio/a2dp.c:a2dp_sink_connect() path /org/bluez/hci0/dev_34_DF_2A_0D_F8_C2 bluetoothd[16493]: a2dp-sink profile connect failed for 34:DF:2A:0D:F8:C2: Device or resource busy bluetoothd[16493]: plugins/policy.c:service_cb() Added Headset Voice gateway reconnect 0 Thanks! On Fri, Oct 11, 2019 at 6:59 AM Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote: > > Hi, > > On Thu, Oct 10, 2019 at 11:13 PM yayfortrees <yayfortrees@gmail.com> wrote: > > > > Hello, > > > > I've attached debug logs for 5.50 nopatch and 5.50 with the patch. > > > > To me it looked like it may be a timing issue - trying to connect the > > a2dp sink too early. As an experiment I put a sleep(1) at the top of > > the hs_cb function from your patch and the a2dp sink was connected. > > With the sleep I still get the "Device or resource busy" error early > > on, but it does reconnect the a2dp sink later in the connection and > > things work. It's not consistent though, maybe 1 of 5 attempts would > > fail to connect the a2dp profile. > > Try with the following patch. > > > I included that debug log as well. > > > > Hope this helps, thanks! > > > > On Thu, Oct 10, 2019 at 2:10 AM Luiz Augusto von Dentz > > <luiz.dentz@gmail.com> wrote: > > > > > > Hi, > > > > > > On Wed, Oct 9, 2019 at 10:51 AM Luiz Augusto von Dentz > > > <luiz.dentz@gmail.com> wrote: > > > > > > > > Hi, > > > > > > > > On Wed, Oct 9, 2019 at 1:56 AM yayfortrees <yayfortrees@gmail.com> wrote: > > > > > > > > > > Hello, > > > > > > > > > > I've attached btmon traces for 5.50 and 5.51. Thanks for taking a look! > > > > > > > > > > Let me know if you need anything else. > > > > > > > > Must likely the following error has something to do with it: > > > > > > > > = bluetoothd: a2dp-sink profile connect failed for 34:DF:2A:0D:F8:C2: > > > > Device or resource busy > > > > > > > > I will check why this could be happening. > > > > > > I tried this one and couldn't reproduce with the headsets I have, > > > could you please run bluetooth -dn and attach the logs here? > > > > > > > > On Tue, Oct 8, 2019 at 4:24 AM Luiz Augusto von Dentz > > > > > <luiz.dentz@gmail.com> wrote: > > > > > > > > > > > > Hi, > > > > > > > > > > > > On Mon, Oct 7, 2019 at 10:34 PM yayfortrees <yayfortrees@gmail.com> wrote: > > > > > > > > > > > > > > Hello, > > > > > > > > > > > > > > I recently upgraded bluez to 5.51 from 5.50 and my headphones stopped > > > > > > > using the A2DP sink during autoconnect. The headphones instead go to > > > > > > > HSP/HFP mode and the A2DP sink is disabled in pavucontrol/pactl. The > > > > > > > A2DP sink will only work when the device is initially paired. > > > > > > > > > > > > > > This had worked flawlessly for years. I was able to track down the > > > > > > > regression to this patch: > > > > > > > https://www.spinics.net/lists/linux-bluetooth/msg76180.html ([PATCH > > > > > > > BlueZ] policy: Add logic to connect a Sink). If I apply the patch to > > > > > > > 5.50, my headphones no longer connect to the A2DP sink, if I remove it > > > > > > > the problem goes away. > > > > > > > > > > > > > > Not sure what else I should include to help track this down. The > > > > > > > headphones I'm using are Beats Wireless (Solo Bluetooth). > > > > > > > > > > > > > > The only relevant log entry I see with the patch applied is: > > > > > > > a2dp-sink profile connect failed for 34:DF:2A:0D:F8:C2: Device or resource busy > > > > > > > > > > > > Can you collect the HCI traces of the problem using btmon? I didn't > > > > > > expect that to cause any problems, it should in theory solve them but > > > > > > lets see. > > > > > > > > > > > > > Let me know if any other information is needed. > > > > > > > Thanks. > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Luiz Augusto von Dentz > > > > > > > > > > > > > > > > -- > > > > Luiz Augusto von Dentz > > > > > > > > > > > > -- > > > Luiz Augusto von Dentz > > > > -- > Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-10-11 17:49 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-10-07 19:30 Bluez stopped connecting A2DP sink yayfortrees 2019-10-08 10:24 ` Luiz Augusto von Dentz [not found] ` <CAJ0=ZJ1pD4dHZe98eZnZ6R-ZBazGip_mrPVV_XjFgThXM0Ebmg@mail.gmail.com> 2019-10-09 7:51 ` Luiz Augusto von Dentz 2019-10-10 8:09 ` Luiz Augusto von Dentz [not found] ` <CAJ0=ZJ17vp_N-P2df6xzVON5yTr0U1v5jk7LTYfrgCpcu6kfBg@mail.gmail.com> 2019-10-11 12:59 ` Luiz Augusto von Dentz 2019-10-11 17:48 ` yayfortrees
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).