# btusb must be loaded after bluetooth service has started

## hasues

I'm seeing some odd behavior:

```
wonder linux # service bluetooth start

 * WARNING: bluetooth has already been started

wonder linux # hciconfig hci0 up

Can't init device hci0: Input/output error (5)

wonder linux # bluetoothctl

[NEW] Controller D8:5D:E2:30:BA:E4 wonder [default]

[bluetooth]# power on

Failed to set power on: org.bluez.Error.Failed

[bluetooth]# exit

[DEL] Controller D8:5D:E2:30:BA:E4 wonder [default]

wonder linux # rmmod btusb

wonder linux # modprobe btusb

wonder linux # hciconfig hci0 up

wonder linux # bluetoothctl

[NEW] Controller D8:5D:E2:30:BA:E4 wonder [default]

[bluetooth]# power on

Changing power on succeeded

[bluetooth]# exit

[DEL] Controller D8:5D:E2:30:BA:E4 wonder [default]
```

This is with bluez5.  Why does the bluetooth service need to be started before loading the btusb module?  Is there some way of managing this?

----------

## hasues

I'm seeing this as well:

```

[  310.221624] Bluetooth: hci0: Failed to access otp area (-113)
```

The device in lsusb:

```
Bus 002 Device 005: ID 0cf3:e300 Atheros Communications, Inc. 
```

I noticed this on Ubuntu's bugs:

https://lists.launchpad.net/kernel-packages/msg130282.html

Perhaps this is a kernel bug.

----------

## Logicien

The btusb module depend on the btintel module who need the firmware files /lib/firmware/intel/intel/ibt-11-5.ddc and /lib/firmware/intel/ibt-11-5.sfi. Is those firmware files are available when Linux probe your Bluetooth Usb dongle? Is the linux-firmware package install?

The Bluetooth service fail the first time because the btusb module is not loaded or it fail to probe your device because of missing firmwares. A rule of thumb for me is to put the firmware files where the Linux support is, in the kernel or, in an initramfs or, in the hard disk. It is important that when Linux start to detect the Bluetooh devices it have at it's disposition the firmware files, otherwise, the probe can fail and no device is detected until the Linux Bluetooth support is reset and the firmware files available.

For Linux Bluetooth support, I put all I can in modules. I don't mix in module with in the kernel.

----------

## hasues

 *Logicien wrote:*   

> The btusb module depend on the btintel module who need the firmware files /lib/firmware/intel/intel/ibt-11-5.ddc and /lib/firmware/intel/ibt-11-5.sfi. Is those firmware files are available when Linux probe your Bluetooth Usb dongle? Is the linux-firmware package install?
> 
> 

 

```
# qlist -Iv |grep linux-firmware

sys-kernel/linux-firmware-20150812
```

```
# ls -la /lib/firmware/intel/ibt-11-5.ddc 

-rw-r--r-- 1 root root 9 Jan 25 20:55 /lib/firmware/intel/ibt-11-5.ddc

# ls -la /lib/firmware/intel/ibt-11-5.sfi

-rw-r--r-- 1 root root 570160 Jan 25 20:55 /lib/firmware/intel/ibt-11-5.sfi
```

I saw this in dmesg:

```
[    4.261015] Bluetooth: hci0: using NVM file: qca/nvm_usb_00000200.bin
```

 *Logicien wrote:*   

> 
> 
> The Bluetooth service fail the first time because the btusb module is not loaded or it fail to probe your device because of missing firmwares.

 

The service does not fail.  It starts.  The hci0 adapter stays in a "DOWN" state and does not allow for changing said state.  That should not be the case upon the bluetooth service starting:

```
# tail /etc/bluetooth/main.conf 

# AutoEnable defines option to enable all controllers when they are found.

# This includes adapters present on start as well as adapters that are plugged

# in later on. Defaults to 'false'.

AutoEnable=true
```

 *Logicien wrote:*   

> 
> 
>  A rule of thumb for me is to put the firmware files where the Linux support is, in the kernel or, in an initramfs or, in the hard disk. It is important that when Linux start to detect the Bluetooh devices it have at it's disposition the firmware files, otherwise, the probe can fail and no device is detected until the Linux Bluetooth support is reset and the firmware files available.
> 
> 

 

That is interesting.  So if I were to use genkernel to generate an initrd image with the firmware, would I simply issue genkernel with say the --firmware-dir argument as such?:

```
# genkernel --firmware-dir=/lib-firmware --lvm initramfs
```

 *Logicien wrote:*   

> 
> 
> For Linux Bluetooth support, I put all I can in modules. I don't mix in module with in the kernel.

 

Agreed, I do the same thing:

```

# lsmod |grep bluetooth

bluetooth             322696  7 bnep,btusb,rfcomm,btintel

rfkill                 14979  4 cfg80211,dell_rbtn,bluetooth

```

  I am a bit confused, however as the l2cap module that used to exist no longer does.  Does this now exist within the bluetooth module itself?

----------

## Logicien

The Bluetooth service will not fail to start even if there is no bluetooth device on the system. It fail to manage your hci0 card because it is not available. What is the output of

```
rfkill list
```

It may be just because the device is block and need to be unblock with

```
rfkill unblock all
```

----------

## hasues

True.  However, if it had been rfkill, the earlier hciconfig would have presented a different message.  It isn't rfkill.

```

# rfkill list

0: dell-rbtn: Wireless LAN

        Soft blocked: no

        Hard blocked: no

1: phy0: Wireless LAN

        Soft blocked: no

        Hard blocked: no

4: hci0: Bluetooth

        Soft blocked: no

        Hard blocked: no
```

Thanks for your help, regardless.

----------

