2023-05-31 09:06:40

by Johan Hovold

[permalink] [raw]
Subject: [PATCH RESEND 0/2] Bluetooth: fix bdaddr quirks

These patches fix a couple of issues with the two bdaddr quirks:

The first one allows HCI_QUIRK_INVALID_BDADDR to be used with
HCI_QUIRK_NON_PERSISTENT_SETUP.

The second patch restores the original semantics of the
HCI_QUIRK_USE_BDADDR_PROPERTY so that the controller is marked as
unconfigured when no device address is specified in the devicetree (as
the quirk is documented to work).

This specifically makes sure that Qualcomm HCI controllers such as
wcn6855 found on the Lenovo X13s are marked as unconfigured until user
space has provided a valid address.

Long term, the HCI_QUIRK_USE_BDADDR_PROPERTY should probably be dropped
in favour of HCI_QUIRK_INVALID_BDADDR and always checking the devicetree
property.

Johan


Johan Hovold (2):
Bluetooth: fix invalid-bdaddr quirk for non-persistent setup
Bluetooth: fix use-bdaddr-property quirk

net/bluetooth/hci_sync.c | 30 +++++++++++-------------------
1 file changed, 11 insertions(+), 19 deletions(-)

--
2.39.3



2023-05-31 09:07:25

by Johan Hovold

[permalink] [raw]
Subject: [PATCH RESEND 1/2] Bluetooth: fix invalid-bdaddr quirk for non-persistent setup

Devices that lack persistent storage for the device address can indicate
this by setting the HCI_QUIRK_INVALID_BDADDR which causes the controller
to be marked as unconfigured until user space has set a valid address.

Once configured, the device address must be set on every setup for
controllers with HCI_QUIRK_NON_PERSISTENT_SETUP to avoid marking the
controller as unconfigured and requiring the address to be set again.

Fixes: 740011cfe948 ("Bluetooth: Add new quirk for non-persistent setup settings")
Signed-off-by: Johan Hovold <[email protected]>
---
net/bluetooth/hci_sync.c | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 0efc2253265e..c2a805ee55cc 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -4618,23 +4618,17 @@ static int hci_dev_setup_sync(struct hci_dev *hdev)
invalid_bdaddr = test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);

if (!ret) {
- if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks)) {
- if (!bacmp(&hdev->public_addr, BDADDR_ANY))
- hci_dev_get_bd_addr_from_property(hdev);
-
- if (bacmp(&hdev->public_addr, BDADDR_ANY) &&
- hdev->set_bdaddr) {
- ret = hdev->set_bdaddr(hdev,
- &hdev->public_addr);
-
- /* If setting of the BD_ADDR from the device
- * property succeeds, then treat the address
- * as valid even if the invalid BD_ADDR
- * quirk indicates otherwise.
- */
- if (!ret)
- invalid_bdaddr = false;
- }
+ if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks) &&
+ !bacmp(&hdev->public_addr, BDADDR_ANY))
+ hci_dev_get_bd_addr_from_property(hdev);
+
+ if ((invalid_bdaddr ||
+ test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks)) &&
+ bacmp(&hdev->public_addr, BDADDR_ANY) &&
+ hdev->set_bdaddr) {
+ ret = hdev->set_bdaddr(hdev, &hdev->public_addr);
+ if (!ret)
+ invalid_bdaddr = false;
}
}

--
2.39.3


2023-05-31 09:52:16

by bluez.test.bot

[permalink] [raw]
Subject: RE: Bluetooth: fix bdaddr quirks

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=752646

---Test result---

Test Summary:
CheckPatch PASS 1.31 seconds
GitLint PASS 0.62 seconds
SubjectPrefix PASS 0.20 seconds
BuildKernel PASS 34.55 seconds
CheckAllWarning PASS 37.25 seconds
CheckSparse PASS 42.93 seconds
CheckSmatch PASS 114.27 seconds
BuildKernel32 PASS 33.57 seconds
TestRunnerSetup PASS 471.26 seconds
TestRunner_l2cap-tester PASS 17.27 seconds
TestRunner_iso-tester FAIL 24.23 seconds
TestRunner_bnep-tester PASS 5.78 seconds
TestRunner_mgmt-tester PASS 117.97 seconds
TestRunner_rfcomm-tester PASS 9.13 seconds
TestRunner_sco-tester PASS 8.52 seconds
TestRunner_ioctl-tester PASS 9.87 seconds
TestRunner_mesh-tester PASS 7.24 seconds
TestRunner_smp-tester PASS 8.32 seconds
TestRunner_userchan-tester PASS 6.05 seconds
IncrementalBuild PASS 36.67 seconds

Details
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 80, Passed: 75 (93.8%), Failed: 5, Not Run: 0

Failed Test Cases
ISO AC 6(i) - Success Failed 0.239 seconds
ISO AC 7(i) - Success Failed 0.237 seconds
ISO AC 8(i) - Success Failed 0.238 seconds
ISO AC 9(i) - Success Failed 0.243 seconds
ISO AC 11(i) - Success Failed 0.238 seconds


---
Regards,
Linux Bluetooth

2023-05-31 19:01:29

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH RESEND 0/2] Bluetooth: fix bdaddr quirks

Hello:

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

On Wed, 31 May 2023 11:04:22 +0200 you wrote:
> These patches fix a couple of issues with the two bdaddr quirks:
>
> The first one allows HCI_QUIRK_INVALID_BDADDR to be used with
> HCI_QUIRK_NON_PERSISTENT_SETUP.
>
> The second patch restores the original semantics of the
> HCI_QUIRK_USE_BDADDR_PROPERTY so that the controller is marked as
> unconfigured when no device address is specified in the devicetree (as
> the quirk is documented to work).
>
> [...]

Here is the summary with links:
- [RESEND,1/2] Bluetooth: fix invalid-bdaddr quirk for non-persistent setup
https://git.kernel.org/bluetooth/bluetooth-next/c/92776a7e761e
- [RESEND,2/2] Bluetooth: fix use-bdaddr-property quirk
https://git.kernel.org/bluetooth/bluetooth-next/c/6ac517d8cf8b

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