I can pair my bluetooth headset with my laptop once. But when I disconnect my headset, I cannot reconnect it again. The only way it works is to restart the bluetooth daemon:
service bluetooth restart
When I do that, I see following in my log:
bluetoothd: Terminating
bluetoothd: Stopping hci0 event socket
bluetoothd: Stopping SDP server
bluetoothd: Exit
bluetoothd: Bluetooth daemon 4.99
bluetoothd: Starting SDP server
bluetoothd: Excluding (conf) network
bluetoothd: Excluding (conf) gatt_example
bluetoothd: Excluding (conf) time
bluetoothd: Excluding (conf) alert
bluetoothd: Failed to open RFKILL control device
bluetoothd: Listening for HCI events on hci0
bluetoothd: HCI dev 0 up
bluetoothd: Proximity GATT Reporter Driver: Operation not permitted (1)
bluetoothd: Could not get the contents of DMI chassis type
bluetoothd: Unable to load keys to adapter_ops: Function not implemented (38)
bluetoothd: Adapter /org/bluez/8237/hci0 has been enabled
then I can successfully connect my headphones:
bluetoothd: Can't open input device: No such file or directory (2)
bluetoothd: AVRCP: failed to init uinput for 44:66:a7:81:3C:84
bluetoothd: Badly formated or unrecognized command: AT+XEVENT=Bose SoundLink,158
bluetoothd: Badly formated or unrecognized command: AT+BIA=0,0,0,1,1,1,0
But when I disconnect them and try connecting again, it does not work, and I see nothing in the logs.
Why can't I reconnect my headphones after disconnecting?
Why do I have to restart bluetooth daemon?
How can I fix this ?
I am using bluez 4.99
on Debian.
I am using custom kernel 4.4.
I am using alsa (no pulseaudio).
Best Answer
It's buggy with certain brands of headsets. I suffer the same problems and this python script to reconnect my bluetooth headset works for me.
Make sure to have at least python 3.5 installed. Directions on how to use the script is self explanatory in the header:
https://gist.github.com/pylover/d68be364adac5f946887b85e6ed6e7ae
Edit: I've included the latest code for this script in this answer as a request but I'd recommend getting the latest iteration from the link provided, as the author is always updating the script.