# Bluetooth disconnects just after connecting

## muoji

Hello everyone

I'm having some issues with bluetooth: I can pair & trust devices, but when I try to connect to the device, it indicates that it managed to connect, but after a few seconds, it disconnects. I have been trying with both a PS4 controller and a bluetooth headset, and I can't get any of those to work.

I've tried using bluetoothctl & blueman, but it doesn't seem to change anything. I have bluez 5.39 installed, and my system is up to date. I've followed the instructions on the wiki (both to set up bluetooth & to connect to the controller/headset), and everything seems to work (I can see devices when I'm scanning, the pair & trust process doesn't give me any error), but nothing seems to be able to stay connected for more than a few seconds.

Can someone help me with that? I've spent hours trying to figure what's wrong, but nothing I found seems to work…

Thanks!

----------

## Logicien

All Bluetooth sound devices are manage by Pulseaudio since Bluez 5 do not support Alsa anymore. So, you need to have Pulseaudio installed and started by the user who is in X session, it should be done automatically, because Pulseaudio is a per user graphical sound server by default.

Have Pavucontrol installed too to manage Pulseaudio. It will show you which sound cards are present including Bluetooth connected headsets, etc.

----------

## muoji

I have pulseaudio & pavucontrol, and they're compiled with bluetooth support, but the headset doesn't stay connected. I think the issue is with bluetooth, since pulseaudio works correctly & the ps4 controller works correctly when connected via usb, but I can't find what the issue is and how to solve it.

----------

## Logicien

Do you have the firmware files available to the module who drive the bluetooth device at the time it probe it? Again, if the bluetooth support is in the kernel image, the appropriate firmware files must be in the kernel image too. Same thing for an initramfs who include the bluetooth support, firmware files must be there.

----------

## muoji

How do I check that? I built bluetooth as a module, and I made sure to follow the same kernel configuration as the one showed on the wiki.

----------

## Logicien

If it is a Usb dongle you can know which modules drive your Bluetooth device with the command

```
lsusb -vvv | less
```

or with

```
lsusb -t
```

It is generally the module btusb who basically drive a Usb Bluetooth dongle. But btusb depend on several modules. One of those, btintel, need the firmware files /lib/firmware/intel/ibt-11-5.ddc and /lib/firmware/intel/ibt-11-5.sfi. Check with

```
lsmod | grep bt
```

which modules are implies to drive your Usb Bluetooth dongle. In the same way, if you need the ath3k module for Bluetooth, this module need the firmware file /usr/lib/firmware/ath3k-1.fw.

If it is a Pci device the principles are the same, find with the command

```
lspci -vvv | less
```

which module drive the Bluetooth device, check it's modules dependancies and be sure that all firmware files are available. When Bluetooth support is in modules, the firmware files need only to be in /lib/firmware directory of the root partition, not in the kernel image or the initramfs, unless you include Bluetooth modules in the initramfs.

Tell us the output of your Bluetooth device given by lsusb or lspci, it will help.

----------

## muoji

The files were missing, I emerged linux-firmware and now I have them. (is this the best way to do it?) I'm not home right now, so I can't check if bluetooth works now, but it seems to be a huge step in the right direction! I'll check if it works correctly in a couple of hours. Thank you for your help!

Edit: it's still not working, but I just noticed in dmesg that the bluetooth module failed to load a broadcom firmware (bcm20702A1-0b05-17cb.hcd). The file is indeed missing, and I don't know where I'm supposed to get it. I found a post talking about this issue, with a link to the .hcd file, but it doesn't seem to be the correct file since I get errors in dmesg when trying to do hciconfig hci0 up. (hci0 command 0x0c03 tx timeout)

----------

## muoji

I found this guide: http://askubuntu.com/questions/632336/bluetooth-broadcom-43142-isnt-working-on-ubuntu/632348#632348, and followed its instructions. The firmware seems to work correctly, I don't have any error in dmesg when bringing hci0 up.

My bluetooth headset is working correctly now, but my ps4 controller still doesn't work. I can connect it once, after doing the pairing process all over again, but it doesn't seem to be detected. If I disconnect it, every time I reconnect it, it disconnects a few seconds later.

----------

## muoji

I still have this issue. I can't find anything online that works. I have no idea where to look to get more information on what's going wrong. dmesg doesn't display anything when I connect my controller, and bluetoothd only tells me that my controller did disconect, but not why. Here's what I get when I start it directly in a terminal:

```

bluetoothd[2313]: src/adapter.c:connected_callback() hci0 device 1C:96:5A:9D:86:8C connected eir_len 5

bluetoothd[2313]: profiles/input/server.c:connect_event_cb() Incoming connection from 1C:96:5A:9D:86:8C on PSM 17

bluetoothd[2313]: profiles/input/device.c:input_device_set_channel() idev 0x55edeeae89f0 psm 17

bluetoothd[2313]: profiles/input/server.c:confirm_event_cb() 

bluetoothd[2313]: profiles/input/server.c:connect_event_cb() Incoming connection from 1C:96:5A:9D:86:8C on PSM 19

bluetoothd[2313]: profiles/input/device.c:input_device_set_channel() idev 0x55edeeae89f0 psm 19

bluetoothd[2313]: profiles/input/device.c:ctrl_watch_cb() Device 1C:96:5A:9D:86:8C disconnected

bluetoothd[2313]: profiles/input/device.c:intr_watch_cb() Device 1C:96:5A:9D:86:8C disconnected

bluetoothd[2313]: profiles/input/device.c:input_device_enter_reconnect_mode() path=/org/bluez/hci0/dev_1C_96_5A_9D_86_8C reconnect_mode=device

bluetoothd[2313]: src/adapter.c:dev_disconnected() Device 1C:96:5A:9D:86:8C disconnected, reason 2

bluetoothd[2313]: src/adapter.c:adapter_remove_connection() 

bluetoothd[2313]: plugins/policy.c:disconnect_cb() reason 2

bluetoothd[2313]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 1C:96:5A:9D:86:8C type 0 status 0xe

bluetoothd[2313]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e

bluetoothd[2313]: src/device.c:device_bonding_failed() status 14

bluetoothd[2313]: src/adapter.c:resume_discovery() 

```

It doesn't look like there's any issue, but I find it weird that there are two connections from the controller.

If anyone has any idea, I'd be happy to hear them…

----------

## Logicien

If your headsets work and you can listen to something using them and Pulseaudio see them, can change the volume and manage this Bluetooth sound card, it may be the Ps4 who disconnect first.

I don't use Ps4 but, try to connect to it alone with no else Bluetooth devices connected or even up. The connection can be initiate by both end. Try both if you need. Be sure your Broadcom Bluetooth Usb dongle is visible.

----------

