2023-03-23 14:05:37

by Raul Cheleguini

[permalink] [raw]
Subject: [PATCH] Bluetooth: Add new quirk for broken extended create connection for ATS2851

The ATS2851 based controller advertises support for command "LE Extended
Create Connection" but does not actually implement it, impeding the
pairing process to begin.

Add the quirk HCI_QUIRK_BROKEN_EXT_CREATE_CONN to avoid the broken command
and send a regular "LE Create Connection" instead.

< 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)

Signed-off-by: Raul Cheleguini <[email protected]>
---
- Note that this patch depends on the RPA timeout quirk sent via [1].
[1]. https://marc.info/?l=linux-bluetooth&m=167957918920723&w=2

drivers/bluetooth/btusb.c | 1 +
include/net/bluetooth/hci.h | 7 +++++++
include/net/bluetooth/hci_core.h | 3 ++-
net/bluetooth/hci_sync.c | 4 ++++
4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 3a3a966419af..8656ac491f13 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -4107,6 +4107,7 @@ static int btusb_probe(struct usb_interface *intf,
set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
set_bit(HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, &hdev->quirks);
set_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &hdev->quirks);
+ set_bit(HCI_QUIRK_BROKEN_EXT_CREATE_CONN, &hdev->quirks);
}

if (!reset)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 07df96c47ef4..d5d0e44bf0b6 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -309,6 +309,13 @@ enum {
* to support it.
*/
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,
};

/* HCI device flags */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 53d3328c2b8b..952b0021dc25 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1695,7 +1695,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))
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 003ec0e34fcc..d49cfd1ea418 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -4534,6 +4534,9 @@ static const struct {
"advertised, but not supported."),
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.")
};

@@ -6071,6 +6074,7 @@ int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn)
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;
--
2.39.2


2023-03-23 14:21:58

by bluez.test.bot

[permalink] [raw]
Subject: RE: Bluetooth: Add new quirk for broken extended create connection for ATS2851

This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----

error: patch failed: drivers/bluetooth/btusb.c:4107
error: drivers/bluetooth/btusb.c: patch does not apply
error: patch failed: include/net/bluetooth/hci.h:309
error: include/net/bluetooth/hci.h: patch does not apply
error: patch failed: net/bluetooth/hci_sync.c:4534
error: net/bluetooth/hci_sync.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch

Please resolve the issue and submit the patches again.


---
Regards,
Linux Bluetooth

2023-04-14 22:41:03

by bluez.test.bot

[permalink] [raw]
Subject: RE: Bluetooth: Add new quirk for broken extended create connection for ATS2851

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=733189

---Test result---

Test Summary:
CheckPatch FAIL 1.63 seconds
GitLint FAIL 0.60 seconds
SubjectPrefix PASS 0.13 seconds
BuildKernel PASS 31.32 seconds
CheckAllWarning PASS 34.82 seconds
CheckSparse PASS 39.43 seconds
CheckSmatch PASS 107.85 seconds
BuildKernel32 PASS 30.63 seconds
TestRunnerSetup PASS 435.55 seconds
TestRunner_l2cap-tester PASS 16.84 seconds
TestRunner_iso-tester PASS 17.28 seconds
TestRunner_bnep-tester PASS 5.51 seconds
TestRunner_mgmt-tester PASS 114.76 seconds
TestRunner_rfcomm-tester PASS 8.82 seconds
TestRunner_sco-tester PASS 8.15 seconds
TestRunner_ioctl-tester PASS 9.49 seconds
TestRunner_mesh-tester PASS 6.95 seconds
TestRunner_smp-tester PASS 8.00 seconds
TestRunner_userchan-tester PASS 5.81 seconds
IncrementalBuild PASS 29.21 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: Add new quirk for broken extended create connection for ATS2851
WARNING: Use lore.kernel.org archive links when possible - see https://lore.kernel.org/lists.html
#109:
[1]. https://marc.info/?l=linux-bluetooth&m=167957918920723&w=2

WARNING: quoted string split across lines
#169: FILE: net/bluetooth/hci_sync.c:4537:
"HCI LE Set Random Private Address Timeout command is "
+ "advertised, but not supported."),

total: 0 errors, 2 warnings, 0 checks, 45 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13185667.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
Bluetooth: Add new quirk for broken extended create connection for ATS2851

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
33: B2 Line has trailing whitespace: " "


---
Regards,
Linux Bluetooth