2023-03-23 13:49:17

by Raul Cheleguini

[permalink] [raw]
Subject: [PATCH] Bluetooth: Add new quirk for broken set random RPA timeout for ATS2851

The ATS2851 based controller advertises support for command "LE Set Random
Private Address Timeout" but does not actually implement it, impeding the
controller initialization.

Add the quirk HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT to unblock the controller
initialization.

< HCI Command: LE Set Resolvable Private... (0x08|0x002e) plen 2
Timeout: 900 seconds
> HCI Event: Command Status (0x0f) plen 4
LE Set Resolvable Private Address Timeout (0x08|0x002e) ncmd 1
Status: Unknown HCI Command (0x01)

Co-developed-by: imoc <[email protected]>
Signed-off-by: imoc <[email protected]>
Signed-off-by: Raul Cheleguini <[email protected]>
---
drivers/bluetooth/btusb.c | 1 +
include/net/bluetooth/hci.h | 8 ++++++++
net/bluetooth/hci_sync.c | 6 +++++-
3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 7382b021f3df..3a3a966419af 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -4105,6 +4105,7 @@ static int btusb_probe(struct usb_interface *intf,
/* Support is advertised, but not implemented */
set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks);
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);
}

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 997107bfc0b1..07df96c47ef4 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -301,6 +301,14 @@ enum {
* don't actually support features declared there.
*/
HCI_QUIRK_BROKEN_LOCAL_EXT_FEATURES_PAGE_2,
+
+ /*
+ * When this quirk is set, the HCI_OP_LE_SET_RPA_TIMEOUT command is
+ * skipped during initialization. This is required for the Actions
+ * Semiconductor ATS2851 based controllers, which erroneously claims
+ * to support it.
+ */
+ HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT,
};

/* HCI device flags */
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 8e5fe73873a8..003ec0e34fcc 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -4090,7 +4090,8 @@ static int hci_le_set_rpa_timeout_sync(struct hci_dev *hdev)
{
__le16 timeout = cpu_to_le16(hdev->rpa_timeout);

- if (!(hdev->commands[35] & 0x04))
+ if (!(hdev->commands[35] & 0x04) ||
+ test_bit(HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, &hdev->quirks))
return 0;

return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_RPA_TIMEOUT,
@@ -4530,6 +4531,9 @@ static const struct {
"HCI Set Event Filter command not supported."),
HCI_QUIRK_BROKEN(ENHANCED_SETUP_SYNC_CONN,
"HCI Enhanced Setup Synchronous Connection command is "
+ "advertised, but not supported."),
+ HCI_QUIRK_BROKEN(SET_RPA_TIMEOUT,
+ "HCI LE Set Random Private Address Timeout command is "
"advertised, but not supported.")
};

--
2.39.2


2023-03-23 14:39:49

by bluez.test.bot

[permalink] [raw]
Subject: RE: Bluetooth: Add new quirk for broken set random RPA timeout 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=733185

---Test result---

Test Summary:
CheckPatch FAIL 1.31 seconds
GitLint PASS 0.27 seconds
SubjectPrefix PASS 0.09 seconds
BuildKernel PASS 32.12 seconds
CheckAllWarning PASS 34.94 seconds
CheckSparse PASS 39.77 seconds
CheckSmatch PASS 109.84 seconds
BuildKernel32 PASS 31.07 seconds
TestRunnerSetup PASS 443.74 seconds
TestRunner_l2cap-tester PASS 15.87 seconds
TestRunner_iso-tester PASS 15.82 seconds
TestRunner_bnep-tester PASS 5.10 seconds
TestRunner_mgmt-tester PASS 102.94 seconds
TestRunner_rfcomm-tester PASS 8.09 seconds
TestRunner_sco-tester PASS 7.47 seconds
TestRunner_ioctl-tester PASS 8.78 seconds
TestRunner_mesh-tester PASS 6.44 seconds
TestRunner_smp-tester PASS 7.42 seconds
TestRunner_userchan-tester PASS 5.30 seconds
IncrementalBuild PASS 29.35 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: Add new quirk for broken set random RPA timeout for ATS2851
WARNING: quoted string split across lines
#152: FILE: net/bluetooth/hci_sync.c:4534:
"HCI Enhanced Setup Synchronous Connection command is "
+ "advertised, but not supported."),

total: 0 errors, 1 warnings, 0 checks, 39 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/13185652.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.




---
Regards,
Linux Bluetooth

2023-04-14 21:33:43

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: Add new quirk for broken set random RPA timeout for ATS2851

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Thu, 23 Mar 2023 10:45:39 -0300 you wrote:
> The ATS2851 based controller advertises support for command "LE Set Random
> Private Address Timeout" but does not actually implement it, impeding the
> controller initialization.
>
> Add the quirk HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT to unblock the controller
> initialization.
>
> [...]

Here is the summary with links:
- Bluetooth: Add new quirk for broken set random RPA timeout for ATS2851
https://git.kernel.org/bluetooth/bluetooth-next/c/cbddddcbd7d6

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html