# [SOLVED] Bluetooth support not working.

## fernan82

Hello,

I have a netbook with a Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter (rev 01). As I understand this is a WiFi + Bluetooth adapter. The bluetooth part is attached to the USB bus and is seen by lsusb as:

```

Bus 004 Device 002: ID 0489:e05f Foxconn / Hon Hai

```

On the 3.12.21 gentoo kernel it is detected as hci0 but it doesn't see any bluetooth devices so I can't pair it. Also if I try to change the adapter name on KDE System Settings > Bluetooth > Adapter it resets itself to BlueZ 5.21. I also tried scanning with bluetoothctl.

On the 3.14.14 gentoo and 3.16.1 vanilla kernels it is not detected at all. On dmesg I see the exact same output as with the 3.12.21 kernel (posted bellow) but it's not seen by bluetoothctl or by KDE bluedevil, it's not on /sys/class/devices/bluetooth and the rfkill switch is gone.

dmesg | grep -i blue output:

```

[    1.800070] Bluetooth: Core ver 2.19

[    1.800107] Bluetooth: HCI device and connection manager initialized

[    1.800115] Bluetooth: HCI socket layer initialized

[    1.800121] Bluetooth: L2CAP socket layer initialized

[    1.800141] Bluetooth: SCO socket layer initialized

[    2.181550] Bluetooth: Virtual HCI driver ver 1.4

[    2.181666] Bluetooth: HCI UART driver ver 2.2

[    2.181672] Bluetooth: HCI H4 protocol initialized

[    2.181675] Bluetooth: HCI BCSP protocol initialized

[    2.181679] Bluetooth: HCILL protocol initialized

[    2.181683] Bluetooth: HCIATH3K protocol initialized

[    2.181686] Bluetooth: HCI Three-wire UART (H5) protocol initialized

[    2.181910] Bluetooth: Generic Bluetooth SDIO driver ver 0.1

[    2.216597] Bluetooth: RFCOMM TTY layer initialized

[    2.216609] Bluetooth: RFCOMM socket layer initialized

[    2.216624] Bluetooth: RFCOMM ver 1.11

[    2.216639] Bluetooth: BNEP (Ethernet Emulation) ver 1.3

[    2.216643] Bluetooth: BNEP filters: protocol multicast

[    2.216650] Bluetooth: BNEP socket layer initialized

[    2.216657] Bluetooth: HIDP (Human Interface Emulation) ver 1.2

[    2.216664] Bluetooth: HIDP socket layer initialized

```

The WiFi adapter is using the ath9k driver and I have the bluetooth co-existance enabled. The WiFi works just fine except that when I was using wpa_supplicant alone it kept getting disconnected. I always seemed to reconnect right away and never did it when I was using the internet, the only symptom was annoying Disconnected/Connected popups on tray wpa_gui tray icon, now I'm using NetworkManager and it works fine (maybe it still happens and NetworkManager doesn't show it?).

Also after I upgraded to the 3.16.1 kernel (I never actually used 3.14.14, I just installed it to see if it happens with a Gentoo kernel) my system would sometimes hang at boot right after displaying the tux logo (more often when running on batteries). Sometimes after a few seconds it would display an error about power: patch file not found: btath3kXXXX.hcf (or something of that sort) and continue booting, other times it would just hang and when I press any key it displays the error and reboots. I got rid of it by disabling the PM runtime functionality feature, it resurfaced once more after resuming from hibernation, this time I disabled the Atheros Firmware download driver and it hasn't resurfaced again.

Any suggestions?

Thanks

FernanLast edited by fernan82 on Mon Sep 01, 2014 11:45 pm; edited 1 time in total

----------

## Logicien

Hello,

do you start the Bluetooth service before doing anything? Without that, no bluetooth device will be seen at least by bluetoothctl. Even when the Bluetooth service is up and running, you may have to put the power on for the Bluetooth device being usable.

In the Bluetooth subshell, you have to excute several commands before the scan can work:

```
[bluetooth]# power on

[bluetooth]# scan on
```

and put your remote Bluetooth device in discovering mode. Your host device can be put in discovering mode too:

```
bluetooth]# discoverable on
```

Does any Bluetooth device is seen by the command

```
hciconfig -a
```

If not, you may miss some firmware files needed by a Bluetooth module. Check the dmesg messages.

About your Atheros wireless card, this trade mark generally work well. Enabling the Bluetooth coexistence is to be done. With Wpa_supplicant, you can use more than one driver, for example -D wext or -D nl80211. nl80211 is suppose to be better. So, try both to see if it's more stable with one than the other. The configuration of /etc/wpa_supplicant/wpa_supplicant.conf is important too.

----------

## fernan82

Hello,

Thanks for the reply. Everything you mentioned about bluetoothctl I've tried, still no devices are discovered, and yes my devices are discoverable and I'm starting the bluetooth deamon at boot. Here's the output of [bluetooth]#show:

```

Controller 1C:3E:84:C6:D2:E2

        Name: BlueZ 5.21

        Alias: BlueZ 5.21

        Class: 0x00010c

        Powered: yes

        Discoverable: yes

        Pairable: yes

        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)

        UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)

        UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)

        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)

        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)

        Modalias: usb:v1D6Bp0246d0515

        Discovering: yes

```

Still no devices are discovered. Also this host cannot be discovered by other devices.

Bellow is the output of hciconfig -a. But this is only when I boot the 3.12.21-gentoo-r1 kernel. The 3.14.14-gentoo and 3.16.1 kernels don't detect it at all (hence no hciconfig output) even though it shows the same dmesg out posted above on all kernels. I would like to use the 3.16.1 kernel because this laptop only supports the EFI framebuffer and it has some problems when used with the Catalyst proprietary driver that where fixed on this version and the open source radeon driver driver has several issues. 

```

hci0:   Type: BR/EDR  Bus: USB

        BD Address: 1C:3E:84:C6:D2:E2  ACL MTU: 1022:8  SCO MTU: 183:5

        UP RUNNING PSCAN ISCAN 

        RX bytes:2285 acl:0 sco:0 events:274 errors:0

        TX bytes:2242 acl:0 sco:0 commands:231 errors:0

        Features: 0xff 0xfe 0x0d 0xfe 0xd8 0x7f 0x7b 0x8f

        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 

        Link policy: RSWITCH HOLD SNIFF 

        Link mode: SLAVE ACCEPT 

        Name: 'BlueZ 5.21'

        Class: 0x00010c

        Service Classes: Unspecified

        Device Class: Computer, Laptop

        HCI Version: 4.1 (0x7)  Revision: 0x3101

        LMP Version: 4.1 (0x7)  Subversion: 0x1

        Manufacturer: Atheros Communications, Inc. (69)

```

One thing that confuses me is which driver it's using? Except for the host controller drivers (which are builtin) all got all USB drivers compiled as modules, yet I don't see any usb modules loaded in lsmod (except hid which is used by the touchscreen). Is there anything like lspci -k for usb that can tell me what drivers a specific device is using? <edit>I found it, HCI USB driver (and all the subsystem drivers which I have compiled builtin), still is there a way to list the modules used by a usb device like lspci -k?</edit>

My laptop has a function key that in windows disables both WiFi and bluetooth. The key has no effect on Linux but I assume it controls the rfkill switch and rfkill list shows that hci0 is not being blocked at all. It has no external switches and bluetooth works on windows.

As for the WiFi device I only mentioned it in case it was relevant to the bluetooth problem since it's a combo adapter. I prefer NetworkManager and I'm happy with the way it works, I only used wpa_supplicant at one point because I didn't knew how to get NetworkManager to connect at boot without logging in to the desktop.

Regards,

Fernan

----------

## Logicien

There is

```
lsusb -t
```

who display the kernel module in use by Usb port. It do not show the device itself that the module is driving on that port.

Is

```
hcitool -i hci0 scanning
```

discover something?

----------

## fernan82

Thanks, I didn't try that, right now I'm on 3.16.1 with no hci0 device but I will reboot in a minute and try it on the 3.12.21 kernel.

I compiled all the bluetooth drivers as modules and upon return the error was back: bluetooth: could not find patch file: ar3k/AthrBT_0x31010000.dfu. I found the file here: https://chromium.googlesource.com/chromiumos/third_party/linux-firmware/+/refs/heads/stabilize-4701.B/ar3k/AthrBT_0x31010000.dfu and added it to the list of firmware blobs. Upon rebooting the error was gone and I see that the modules are loaded but I still cannot see the device.

I think I'm missing a virtual fs option on my kernel so it can create the hci device. One thing I disabled on the 3.14.14 and that is missing on the vanilla kernel is Gentoo's persistent device naming option, I disabled it on the 3.14.14 kernel because it breaks a USB CDC device I use but this option is supposed to enable some virtual filesystems.

I will try to compile the 3.12.21 kernel with the firmware blob now, hopefully that'll get it bluetooth to work then I just have to figure out how to get the device to show on 3.16.1.

----------

## fernan82

hcitool -i hci0 scanning didn't discover anything but I causes the following to be logged in dmesg:

```

[  955.850807] Bluetooth: hci0 command 0x0401 tx timeout

```

It will do that the 1st time I run it, after that if I run it again it scans for about 30 seconds and returns without logging anything but if I got to bluetoothctl and run show it's still shows like it's scanning, if I try scan off it gives me Failed to stop discovery: org.bluez.Error.Failed but if I run scan on and then scan off again they both succeed. If I then exit bluetoothctl and run hcitool -i hci0 scanning again it will log the error on dmesg again.

Also now that I got the firmware file compiled into my kernel if I run show on bluetoothctl I got more services listed:

```

Controller 1C:3E:84:C6:D2:E2

        Name: BlueZ 5.21

        Alias: BlueZ 5.21

        Class: 0x1c010c

        Powered: yes

        Discoverable: yes

        Pairable: yes

        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)

        UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)

        UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)

        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)

        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)

        UUID: Message Notification Se.. (00001133-0000-1000-8000-00805f9b34fb)

        UUID: Message Access Server     (00001132-0000-1000-8000-00805f9b34fb)

        UUID: Phonebook Access Server   (0000112f-0000-1000-8000-00805f9b34fb)

        UUID: IrMC Sync                 (00001104-0000-1000-8000-00805f9b34fb)

        UUID: OBEX File Transfer        (00001106-0000-1000-8000-00805f9b34fb)

        UUID: OBEX Object Push          (00001105-0000-1000-8000-00805f9b34fb)

        UUID: Vendor specific           (00005005-0000-1000-8000-0002ee000001)

        UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)

        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)

        Modalias: usb:v1D6Bp0246d0515

        Discovering: yes

```

and also two more dmesg entries are logged during startup:

```

[    3.596292] btusb 4-2:1.0: usb_probe_interface

[    3.596302] btusb 4-2:1.0: usb_probe_interface - got id

```

Other than that I still can't use bluetooth :(

----------

## Logicien

The file AthrBT_0x31010000.dfu is part of the linux-firmware package. You should install that package.

I have an hypothesis about integrated devices like Bluetooh in netbooks. You probably ever install Windows drivers. The installer often say "Dont plug the device until the driver installation is finish.". That's mean the driver must be ready to probe the device. If the device is detected before the driver is ready including firmware files access, the initialisation will fail.

The problem with integrated devices is that you cannot unplug them. They are there before Linux start and are detected when probed. At this moment, if you do not have everything needed in the kernel and/or in the initramfs, the initialisation fail.

After the boot is finish, the only choice you have, is to stop the Bluetooth service, unload the related modules, load them again and start the service again. So, you can try that if nothing work.

And other thing you can do, is to put everything needed for the Usb and Bluetooth support in the kernel image or at least in an initramfs, including the firmwares to permit Linux to be able to initialise the Bluetooth device as early as possible.

Remember, restart the Bluetooth service need to restart Pulseaudio too for Bluetooth audio.

Note that the Bluetooth service may need to be reconfigure otherwise than the default in /etc/bluetooth.

Note too that Systemd, Bluez (5), Dbus and Pulseaudio work all together. Systemd manage users permissions with Logind. If you use Openrc, you need Consolekit to manage user permissions.

If you look at the file /etc/dbus-1/system.d/bluetooth.conf, users must be in the lp and/or plugdev groups to comminicate with Bluetooth devices. Have you try Bluetooth scans as the root user to be sure permissions are not in causes?

Is the Bluetooth Usb device good enough in the netbook?

----------

## fernan82

 *Logicien wrote:*   

> 
> 
> The file AthrBT_0x31010000.dfu is part of the linux-firmware package. You should install that package.
> 
> 

 

That's it! Installed the package, rebooted and it was detected and working right away. Thanks for your time and patience.

----------

## feniksa

Just will add my fifty-cents.

If you see your bluetooth device with bluetoothctl and everything looks fine, but your bluetooth are NOT turning on (in dmesg you see "command timeout"  errors).

Sometimes to get rid of this error, it may help fully turn off computer and remove AC cable[/b]. 

This bug can be found with some laptops, like ASUS with Qualcomm Atheros chip. This error also can happen on other devices with dual windows machines. If you hibernate your laptop, and then switch to windows - you will be unable to use your bluetooth device (because wifi-bluetooth chip in state, that can't be recognized by Linux module).

----------

