Bug 204629

Summary: Bluetooth headset auto connected but failed to recognize as audio device
Product: Drivers Reporter: Guo Yunhe (i)
Component: BluetoothAssignee: linux-bluetooth (linux-bluetooth)
Status: NEW ---    
Severity: normal CC: codyrude, juha-pekka.savolainen, mirh, pali
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.2.8 Subsystem:
Regression: No Bisected commit-id:

Description Guo Yunhe 2019-08-19 20:52:20 UTC
This bug was originally reported to KDE https://bugs.kde.org/show_bug.cgi?id=368883

When i start my headset, my bluetooth headset is autoconnect to kde. 
When it finish, the device is not added to output sound device. 

When i diconnect and reconnect manualy, it works :) 



Reproducible: Always

Steps to Reproduce:

1. Pair a bluetooth headet and configure it as auto connect
2. Auto connect the headset.
3. If not recognized, disconect and reconnect the headset manually.

Expected Results:  

Audio device should be recognized automatically

Actual Results:  

Audio device is not recognized. But when manually connect to it, it can be recognized as audio device by PulseAudio.

System logs:

bluetoothd[1896]: Unable to get io data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107)
dbus-daemon[953]: [system] Rejected send message, 1 matched rules; type="method_return", sender=":1.37" (uid=1000 pid=2239 comm="/usr/bin/pulseaudio --daemonize=no ") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.11" (uid=0 pid=1896 comm="/usr/lib/bluetooth/bluetoothd ")

I guess the cause might be: when the bluetooth signal appears, Bluez immediately connect to it and try to exchange data with it. But the headset is still booting and not ready for answering any request. And Bluez failed without retrying. Maybe it should keep trying every 3 seconds, maximum 5 times (15 seconds).
Comment 1 Pali Rohár 2020-04-28 00:12:47 UTC
Could you please compile and run bluetoothd daemon from git master branch https://git.kernel.org/pub/scm/bluetooth/bluez.git/ ?

"Unable to get io data" is wrong error message and real one was removed by bluetoothd daemon. So from log we do not know what happen.

Reporting of this incorrect message was fixed just few days ago in git master branch, so compiling and testing new bluetoothd daemon from git is needed.
Comment 2 Juha-Pekka Savolainen 2021-05-24 11:30:30 UTC
Can you provide relevant commit(s) in master branch? I'm facing similar looking issue but can not upgrade the BlueZ. I could however try by patching the current version if pointed to correct commit(s).
Comment 3 mirh 2021-09-09 17:07:13 UTC
b0ebdd778b06a71c1cbc2fcf30d7fe5842e749fb I guess?
Is this still a thing?
Comment 4 Cody Rude 2021-10-17 03:44:02 UTC
I'm having this same problem in bluez 5.62, which contains the commit to provide more updated logging information. However, the original error message is appearing, which I guess implies that this is an io error and not a regular error.

Here are my bluetooth logs:

> Oct 16 21:58:51 Neltharion bluetoothd[413]: Bluetooth daemon 5.62
> Oct 16 21:58:51 Neltharion bluetoothd[413]: Starting SDP server
> Oct 16 21:58:51 Neltharion bluetoothd[413]: Bluetooth management interface
> 1.21 initialized
> Oct 16 21:58:51 Neltharion dbus-daemon[414]: [system] Activating via systemd:
> service name='org.freedesktop.hostname1'
> unit='dbus-org.freedesktop.hostname1.service' requested by ':1.2' (uid=0
> pid=413 comm="/usr/lib/bluetooth/bluetoothd ")
> Oct 16 22:09:46 Neltharion bluetoothd[413]: Endpoint registered: sender=:1.37
> path=/MediaEndpoint/A2DPSink/sbc
> Oct 16 22:09:46 Neltharion bluetoothd[413]: Endpoint registered: sender=:1.37
> path=/MediaEndpoint/A2DPSource/sbc
> Oct 16 22:09:46 Neltharion bluetoothd[413]: Endpoint registered: sender=:1.37
> path=/MediaEndpoint/A2DPSink/sbc_xq_453
> Oct 16 22:09:46 Neltharion bluetoothd[413]: Endpoint registered: sender=:1.37
> path=/MediaEndpoint/A2DPSource/sbc_xq_453
> Oct 16 22:09:46 Neltharion bluetoothd[413]: Endpoint registered: sender=:1.37
> path=/MediaEndpoint/A2DPSink/sbc_xq_512
> Oct 16 22:09:46 Neltharion bluetoothd[413]: Endpoint registered: sender=:1.37
> path=/MediaEndpoint/A2DPSource/sbc_xq_512
> Oct 16 22:09:46 Neltharion bluetoothd[413]: Endpoint registered: sender=:1.37
> path=/MediaEndpoint/A2DPSink/sbc_xq_552
> Oct 16 22:09:46 Neltharion bluetoothd[413]: Endpoint registered: sender=:1.37
> path=/MediaEndpoint/A2DPSource/sbc_xq_552
> Oct 16 22:11:32 Neltharion bluetoothd[413]:
> src/profile.c:ext_io_disconnected() Unable to get io data for Hands-Free
> Voice gateway: getpeername: Transport endpoint is not connected (107)
Comment 5 Cody Rude 2021-10-24 04:40:22 UTC
I've discovered that setting the headphones as trusted fixes the issue and it auto-connects properly