Skip to content

Commit eb1904f

Browse files
holtmannjhedberg
authored andcommitted
Bluetooth: Add quirk for external configuration requirement
When a controller requires external configuration, then setting this quirk will allow indicating this. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
1 parent 42a9bc1 commit eb1904f

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

‎include/net/bluetooth/hci.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,15 @@ enum {
111111
*/
112112
HCI_QUIRK_BROKEN_STORED_LINK_KEY,
113113

114+
/* When this quirk is set, an external configuration step
115+
* is required and will be indicated with the controller
116+
* configuation.
117+
*
118+
* This quirk can be set before hci_register_dev is called or
119+
* during the hdev->setup vendor callback.
120+
*/
121+
HCI_QUIRK_EXTERNAL_CONFIG,
122+
114123
/* When this quirk is set, the public Bluetooth address
115124
* initially reported by HCI Read BD Address command
116125
* is considered invalid. Controller configuration is

‎net/bluetooth/hci_core.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2249,7 +2249,8 @@ static int hci_dev_do_open(struct hci_dev *hdev)
22492249
if (hdev->setup && test_bit(HCI_SETUP, &hdev->dev_flags)) {
22502250
ret = hdev->setup(hdev);
22512251

2252-
if (test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks))
2252+
if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) ||
2253+
test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks))
22532254
set_bit(HCI_UNCONFIGURED, &hdev->dev_flags);
22542255
}
22552256

‎net/bluetooth/mgmt.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,9 @@ static __le32 get_missing_options(struct hci_dev *hdev)
445445
{
446446
u32 options = 0;
447447

448+
if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks))
449+
options |= MGMT_OPTION_EXTERNAL_CONFIG;
450+
448451
if (test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks) &&
449452
!bacmp(&hdev->public_addr, BDADDR_ANY))
450453
options |= MGMT_OPTION_PUBLIC_ADDRESS;
@@ -465,6 +468,9 @@ static int read_config_info(struct sock *sk, struct hci_dev *hdev,
465468
memset(&rp, 0, sizeof(rp));
466469
rp.manufacturer = cpu_to_le16(hdev->manufacturer);
467470

471+
if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks))
472+
options |= MGMT_OPTION_EXTERNAL_CONFIG;
473+
468474
if (hdev->set_bdaddr)
469475
options |= MGMT_OPTION_PUBLIC_ADDRESS;
470476

@@ -509,7 +515,8 @@ static u32 get_supported_settings(struct hci_dev *hdev)
509515
settings |= MGMT_SETTING_PRIVACY;
510516
}
511517

512-
if (hdev->set_bdaddr)
518+
if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) ||
519+
hdev->set_bdaddr)
513520
settings |= MGMT_SETTING_CONFIGURATION;
514521

515522
return settings;

0 commit comments

Comments
 (0)