Bluetooth: btusb: Add quirks for ATS2851
Subsystems (2)
cover Bluetooth: btusb: Add quirks for ATS2851
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
Quoted 1 line
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)Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4 #61142 [hci0] 3949.348227
LE Read Remote Used Features (0x08|0x0016) ncmd 1
Status: Success (0x00)Quoted 1 line
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 Encryptionbluetoothd[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)Quoted 1 line
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(-)
Signature · 1 line
2.43.0
PATCH 1/3 Bluetooth: Add new quirks for ATS2851
This adds quirks for broken extended create connection, and write auth payload timeout.
--- include/net/bluetooth/hci.h | 14 ++++++++++++++ include/net/bluetooth/hci_core.h | 10 ++++++---- 2 files changed, 20 insertions(+), 4 deletions(-)
include/net/bluetooth/hci.h +14 -0
@@ -300,6 +300,20 @@ enum {*/ HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT , +/* +* When this quirk is set, the HCI_OP_LE_EXT_CREATE_CONN command is +* disabled. This is required for the Actions Semiconductor ATS2851 +* based controllers, which erroneously claims to support it. +*/ +HCI_QUIRK_BROKEN_EXT_CREATE_CONN , + +/* +* When this quirk is set, the command WRITE_AUTH_PAYLOAD_TIMEOUT is +* skipped. This is required for the Actions Semiconductor ATS2851 +* based controllers, due to a race condition in pairing process. +*/ +HCI_QUIRK_BROKEN_WRITE_AUTH_PAYLOAD_TIMEOUT , +/* When this quirk is set, MSFT extension monitor tracking by * address filter is supported. Since tracking quantity of each * pattern is limited, this feature supports tracking multiple
include/net/bluetooth/hci_core.h +6 -4
@@ -1871,8 +1871,8 @@ void hci_conn_del_sysfs(struct hci_conn *conn); !test_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &(dev)->quirks))/* Use ext create connection if command is supported */ -#define use_ext_conn (dev) ((dev)->commands[37] & 0x80) - +#define use_ext_conn (dev) (((dev)->commands[37] & 0x80) && \ + !test_bit(HCI_QUIRK_BROKEN_EXT_CREATE_CONN, &(dev)->quirks))/* Extended advertising support */ #define ext_adv_capable (dev) (((dev)->le_features[1] & HCI_LE_EXT_ADV))
@@ -1885,8 +1885,10 @@ void hci_conn_del_sysfs(struct hci_conn *conn);* C24: Mandatory if the LE Controller supports Connection State and either * LE Feature (LL Privacy) or LE Feature (Extended Advertising) is supported */ -#define use_enhanced_conn_complete (dev) (ll_privacy_capable(dev) || \ - ext_adv_capable(dev)) +#define use_enhanced_conn_complete (dev) ((ll_privacy_capable(dev) || \ + ext_adv_capable(dev)) && \ + !test_bit(HCI_QUIRK_BROKEN_EXT_CREATE_CONN, \ + &(dev)->quirks))/* Periodic advertising support */ #define per_adv_capable (dev) (((dev)->le_features[1] & HCI_LE_PERIODIC_ADV))
Signature · 1 line
2.43.0
PATCH 2/3 Bluetooth: Support new quirks for ATS2851
In reply to Danil PylaevThis adds support for quirks for broken extended create connection, and write auth payload timeout.
--- net/bluetooth/hci_event.c | 7 +++++++ net/bluetooth/hci_sync.c | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-)
net/bluetooth/hci_event.c +7 -0
@@ -3626,6 +3626,13 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, void *data, goto unlock; } +/* We skip the WRITE_AUTH_PAYLOAD_TIMEOUT for ATS2851 based controllers +* to avoid unexpected SMP command errors when pairing. +*/ +if (test_bit (HCI_QUIRK_BROKEN_WRITE_AUTH_PAYLOAD_TIMEOUT , + &hdev->quirks)) + goto notify; +/* Set the default Authenticated Payload Timeout after * an LE Link is established. As per Core Spec v5.0, Vol 2, Part B * Section 3.3, the HCI command WRITE_AUTH_PAYLOAD_TIMEOUT should be
net/bluetooth/hci_sync.c +8 -1
@@ -4838,6 +4838,13 @@ static const struct {HCI_QUIRK_BROKEN (SET_RPA_TIMEOUT ,"HCI LE Set Random Private Address Timeout command is " "advertised, but not supported." ), +HCI_QUIRK_BROKEN (EXT_CREATE_CONN , +"HCI LE Extended Create Connection command is " +"advertised, but not supported." ), +HCI_QUIRK_BROKEN (WRITE_AUTH_PAYLOAD_TIMEOUT , +"HCI WRITE AUTH PAYLOAD TIMEOUT command leads " +"to unexpected SMP errors when pairing " +"and will not be used." ),HCI_QUIRK_BROKEN (LE_CODED ,"HCI LE Coded PHY feature bit is set, " "but its usage is not supported." )
@@ -6467,7 +6474,7 @@ static int hci_le_create_conn_sync(struct hci_dev *hdev, void *data) &own_addr_type);if (err) goto done; - +/* Send command LE Extended Create Connection if supported */ if (use_ext_conn (hdev)) { err =hci_le_ext_create_conn_sync (hdev, conn, own_addr_type); goto done;
Signature · 1 line
2.43.0
PATCH 3/3 Bluetooth: Set quirks for ATS2851
In reply to Danil PylaevThis adds quirks for broken ats2851 features.
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -3930,6 +3930,8 @@ static int btusb_probe(struct usb_interface *intf,set_bit (HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT , &hdev->quirks);set_bit (HCI_QUIRK_BROKEN_EXT_SCAN , &hdev->quirks);set_bit (HCI_QUIRK_BROKEN_READ_ENC_KEY_SIZE , &hdev->quirks); +set_bit (HCI_QUIRK_BROKEN_EXT_CREATE_CONN , &hdev->quirks); +set_bit (HCI_QUIRK_BROKEN_WRITE_AUTH_PAYLOAD_TIMEOUT , &hdev->quirks); }if (!reset)
Signature · 1 line
2.43.0
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 10 lines · On Mon, 21 Oct 2024 12:22:43 +0000 you wrote:
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.[...]
Here is the summary with links:
- [1/3] Bluetooth: Add new quirks for ATS2851
https://git.kernel.org/bluetooth/bluetooth-next/c/ff4565bd7117 - [2/3] Bluetooth: Support new quirks for ATS2851 https://git.kernel.org/bluetooth/bluetooth-next/c/90f7f7538d07 - [3/3] Bluetooth: Set quirks for ATS2851 https://git.kernel.org/bluetooth/bluetooth-next/c/017dced0da79
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html