Bug 64671

Summary: hci0 command 0x1009 tx timeout, bluez can't find adapter
Product: Drivers Reporter: Aleksandr Mezin (mezin.alexander)
Component: BluetoothAssignee: linux-bluetooth (linux-bluetooth)
Status: NEW ---    
Severity: normal CC: fademind, franchesko.salias.hudro.pedros, giuseppe.devito.gdv, leif.liddy, mohammad.rasim96, ongun.kanat+kernelbugzilla, radek
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.12.0 Subsystem:
Regression: No Bisected commit-id:

Description Aleksandr Mezin 2013-11-10 04:47:16 UTC
Usually, Bluez doesn't detect my bluetooth adapter (bluedevil says "no adapters found", bluez-test-device fails with org.bluez.Error.NoSuchAdapter: No such adapter).
Also, I get "Bluetooth: hci0 command 0x1009 tx timeout" in dmesg.

However, if I run "hciconfig hci0 up", and then reboot, everything starts to work. After reboot I don't see "hci0 command 0x1009 tx timeout".

If I turn off my laptop, and then turn it on, bluetooth doesn't work again.

My adapter is:
0a5c:21b4 Broadcom Corp. BCM2070 Bluetooth 2.1 + EDR
(usb)

rfkill list:
0: hp-wifi: Wireless LAN
        Soft blocked: no
        Hard blocked: no
1: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no
2: hp-bluetooth: Bluetooth
        Soft blocked: no
        Hard blocked: no
3: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no
Comment 1 Aleksandr Mezin 2013-12-16 19:30:15 UTC
rmmod btusb && modprobe btusb helps
Comment 2 Giuseppe 2015-07-30 01:34:24 UTC
I confirm this bug. Everything corresponds to my situation, except that my adapter is: 
0930:0214 Broadcom Corp EDR.
My kernel is:
3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) x86_64
Comment 3 fademind 2017-01-18 09:32:22 UTC
This issue is related with btusb module driver.

Seems like driver is loaded too fast and usb device is not ready.

Reload driver is hard workaround.

My device:

Bus 001 Device 008: ID 13d3:3362 IMC Networks Atheros AR3012 Bluetooth 4.0 Adapter
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass          224 Wireless
  bDeviceSubClass         1 Radio Frequency
  bDeviceProtocol         1 Bluetooth
  bMaxPacketSize0        64
  idVendor           0x13d3 IMC Networks
  idProduct          0x3362 Atheros AR3012 Bluetooth 4.0 Adapter
  bcdDevice            0.02
  iManufacturer           1 Atheros Communications
  iProduct                2 Bluetooth USB Host Controller
  iSerial                 3 Alaska Day 2006
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          177
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          4 BT HCI
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       3
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0019  1x 25 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0019  1x 25 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       4
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       5
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0031  1x 49 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0031  1x 49 bytes
        bInterval               1
Device Status:     0x0001
  Self Powered
Comment 4 fademind 2017-01-18 09:34:02 UTC
I forgot mention: this issue still persist in 4.9 kernel series.
Comment 5 Leif Liddy 2017-01-29 21:50:51 UTC
Have you tried resetting the usb port? Fixed an issue on my laptop where the bluetooth controller wouldn't work after suspend+resume. Was receiving the same sort of timeout errors. Worth a shot in any case.

#!/usr/bin/python

from usb.core import find as finddev
dev = finddev(idVendor=0x13d3, idProduct=0x3362)
dev.reset()


**I wouldn't normally post a python script, but in this case, it's much simpler then the corresponding shell script would be

**requires pyusb to run. "pip install pyusb" or "dnf install pyusb"
Comment 6 MOHAMMAD RASIM 2017-01-30 07:14:57 UTC
I have the same issue and the same dmesg error.

My adapter is:
Broadcom Corporation BCM4313 802.11bgn Wireless Network Adapter [14e4:4727] (rev 01)
I had the problem on archlinux but now I'm running linux mint and have the same problem.

Current kernel:
Linux mohammad-mint 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Comment 7 Ongun Kanat 2017-02-13 00:44:40 UTC
I've got same behavior on 4.9.8 kernel on PC with Atheros AR3012 card.
Comment 8 Maxim Moseychuk 2017-03-02 00:55:12 UTC
(In reply to Ongun Kanat from comment #7)
> I've got same behavior on 4.9.8 kernel on PC with Atheros AR3012 card.

(In reply to MOHAMMAD RASIM from comment #6)
> I have the same issue and the same dmesg error.
> 
> My adapter is:
> Broadcom Corporation BCM4313 802.11bgn Wireless Network Adapter [14e4:4727]
> (rev 01)
> I had the problem on archlinux but now I'm running linux mint and have the
> same problem.
> 
> Current kernel:
> Linux mohammad-mint 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC
> 2016 x86_64 x86_64 x86_64 GNU/Linux

Can someone test my patch? This bug not always reproduce, and i need help for test 1-2 week.

I can send raw patch, branch on github or PKGBUILD for archlinux.
Comment 9 MOHAMMAD RASIM 2017-03-29 22:58:46 UTC
(In reply to Maxim Moseychuk from comment #8)
> (In reply to Ongun Kanat from comment #7)
> > I've got same behavior on 4.9.8 kernel on PC with Atheros AR3012 card.
> 
> (In reply to MOHAMMAD RASIM from comment #6)
> > I have the same issue and the same dmesg error.
> > 
> > My adapter is:
> > Broadcom Corporation BCM4313 802.11bgn Wireless Network Adapter [14e4:4727]
> > (rev 01)
> > I had the problem on archlinux but now I'm running linux mint and have the
> > same problem.
> > 
> > Current kernel:
> > Linux mohammad-mint 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC
> > 2016 x86_64 x86_64 x86_64 GNU/Linux
> 
> Can someone test my patch? This bug not always reproduce, and i need help
> for test 1-2 week.
> 
> I can send raw patch, branch on github or PKGBUILD for archlinux.

I can test the patch can you send it please?
Comment 10 fademind 2017-03-30 05:29:11 UTC
(In reply to Maxim Moseychuk from comment #8)
> 
> Can someone test my patch? This bug not always reproduce, and i need help
> for test 1-2 week.
> 
> I can send raw patch, branch on github or PKGBUILD for archlinux.

Please send me your patch. Thanks