mbox series

[0/3] Bluetooth: btusb: Add quirks for ATS2851

Message ID 20241021122246.1569235-1-danstiv404@gmail.com
Headers show
Series Bluetooth: btusb: Add quirks for ATS2851 | expand

Message

Danil Pylaev Oct. 21, 2024, 12:22 p.m. UTC
The controller based on ATS2851 advertises support for the "LE
Extended Create Connection" command, but it does not actually
implement it. This issue is blocking the pairing process from
beginning.

To resolve this, add the quirk HCI_QUIRK_BROKEN_EXT_CREATE_CONN.
This will avoid the unsupported command and instead send a regular "LE
Create Connection" command.

< HCI Command: LE Extended Create Conn.. (0x08|0x0043) plen 26
        Filter policy: Accept list is not used (0x00)
        Own address type: Public (0x00)
        Peer address type: Random (0x01)
        Peer address: DD:5E:B9:FE:49:3D (Static)
        Initiating PHYs: 0x01
        Entry 0: LE 1M
          Scan interval: 60.000 msec (0x0060)
          Scan window: 60.000 msec (0x0060)
          Min connection interval: 30.00 msec (0x0018)
          Max connection interval: 50.00 msec (0x0028)
          Connection latency: 0 (0x0000)
          Supervision timeout: 420 msec (0x002a)
          Min connection length: 0.000 msec (0x0000)
          Max connection length: 0.000 msec (0x0000)
HCI Event: Command Status (0x0f) plen 4
      LE Extended Create Connection (0x08|0x0043) ncmd 1
        Status: Unknown HCI Command (0x01)

This is a resubmission of a patch based on current bluetooth-next/master.

Also I noticed the following problem:
1. The connection with the LE device is stable for 10-20 hours,
the device is periodically turned off and on,
the connection is restored after the device is turned on.

2. At some point after the connection is broken,it is no longer restored,
the adapter sends an mtu request, does not receive a response,
and connection is closed.

@ MGMT Event: Device Connected (0x000b) plen 40     {0x0001} [hci0] 3949.336820
        LE Address: E8:42:26:5C:0F:07 (Static)
        Flags: 0x00000008
          Connection Locally Initiated
        Data length: 27
        Name (complete): RFS-KKL002
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        Company: Transenergooil AG (450)
          Data: 4000070f5c2642e8
btmon[11980]: @ RAW Open: btmon (privileged) version 2.22  {0x0002} 3949.336952
btmon[11980]: @ RAW Close: btmon                           {0x0002} 3949.336962
> HCI Event: LE Meta Event (0x3e) plen 4              #61140 [hci0] 3949.339079
      LE Channel Selection Algorithm (0x14)
        Handle: 1536 Address: E8:42:26:5C:0F:07 (Static)
        Algorithm: #1 (0x00)
< HCI Command: LE Read Remote.. (0x08|0x0016) plen 2  #61141 [hci0] 3949.346390
        Handle: 1536 Address: E8:42:26:5C:0F:07 (Static)
> HCI Event: Command Status (0x0f) plen 4             #61142 [hci0] 3949.348227
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 12             #61143 [hci0] 3949.414952
      LE Read Remote Used Features (0x04)
        Status: Success (0x00)
        Handle: 1536 Address: E8:42:26:5C:0F:07 (Static)
        Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
          LE Encryption
bluetoothd[422]: < ACL Data TX:... flags 0x00 dlen 7  #61144 [hci0] 3949.415720
      ATT: Exchange MTU Request (0x02) len 2
        Client RX MTU: 517
bluetoothd[422]: @ MGMT Command:.. (0x0014) plen 7  {0x0001} [hci0] 3948.495765
        LE Address: E8:42:26:5C:0F:07 (Static)
< HCI Command: Disconnect (0x01|0x0006) plen 3        #61115 [hci0] 3948.495995
        Handle: 1536 Address: E8:42:26:5C:0F:07 (Static)
        Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4             #61116 [hci0] 3948.497701
      Disconnect (0x01|0x0006) ncmd 1
        Status: Success (0x00)

The important thing is that the response to mtu request stops coming from other devices (tested with two le devices).
Therefore this is not a problem with end devices.

Doing power off / power on from bluetoothctl temporarily solves this problem for a few hours.

Danil Pylaev (3):
  Bluetooth: Add new quirks for ATS2851
  Bluetooth: Support new quirks for ATS2851
  Bluetooth: Set quirks for ATS2851

 drivers/bluetooth/btusb.c        |  2 ++
 include/net/bluetooth/hci.h      | 14 ++++++++++++++
 include/net/bluetooth/hci_core.h | 10 ++++++----
 net/bluetooth/hci_event.c        |  7 +++++++
 net/bluetooth/hci_sync.c         |  9 ++++++++-
 5 files changed, 37 insertions(+), 5 deletions(-)