Bluetooth: Add quirk for external configuration requirement
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 4 Jul 2014 15:23:33 +0000 (17:23 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Fri, 4 Jul 2014 18:08:15 +0000 (21:08 +0300)
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>
include/net/bluetooth/hci.h
net/bluetooth/hci_core.c
net/bluetooth/mgmt.c

index 148b21699446822b1e5d6b1498300fd5fa2091ab..4f1c4c7e2f00da23516e41f950276fd9e8b22284 100644 (file)
@@ -111,6 +111,15 @@ enum {
         */
        HCI_QUIRK_BROKEN_STORED_LINK_KEY,
 
+       /* When this quirk is set, an external configuration step
+        * is required and will be indicated with the controller
+        * configuation.
+        *
+        * This quirk can be set before hci_register_dev is called or
+        * during the hdev->setup vendor callback.
+        */
+       HCI_QUIRK_EXTERNAL_CONFIG,
+
        /* When this quirk is set, the public Bluetooth address
         * initially reported by HCI Read BD Address command
         * is considered invalid. Controller configuration is
index c92bee84413f657f918c084661ea019932984cfd..c007b3543e702f39c7b9a1dec4b7da7d40de74b5 100644 (file)
@@ -2249,7 +2249,8 @@ static int hci_dev_do_open(struct hci_dev *hdev)
        if (hdev->setup && test_bit(HCI_SETUP, &hdev->dev_flags)) {
                ret = hdev->setup(hdev);
 
-               if (test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks))
+               if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) ||
+                   test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks))
                        set_bit(HCI_UNCONFIGURED, &hdev->dev_flags);
        }
 
index 766411e11ac7b24d10c126076bb18954d31b757d..d2d0e051e4f260d46e165ea6c108d1f713b3cf25 100644 (file)
@@ -445,6 +445,9 @@ static __le32 get_missing_options(struct hci_dev *hdev)
 {
        u32 options = 0;
 
+       if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks))
+               options |= MGMT_OPTION_EXTERNAL_CONFIG;
+
        if (test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks) &&
            !bacmp(&hdev->public_addr, BDADDR_ANY))
                options |= MGMT_OPTION_PUBLIC_ADDRESS;
@@ -465,6 +468,9 @@ static int read_config_info(struct sock *sk, struct hci_dev *hdev,
        memset(&rp, 0, sizeof(rp));
        rp.manufacturer = cpu_to_le16(hdev->manufacturer);
 
+       if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks))
+               options |= MGMT_OPTION_EXTERNAL_CONFIG;
+
        if (hdev->set_bdaddr)
                options |= MGMT_OPTION_PUBLIC_ADDRESS;
 
@@ -509,7 +515,8 @@ static u32 get_supported_settings(struct hci_dev *hdev)
                settings |= MGMT_SETTING_PRIVACY;
        }
 
-       if (hdev->set_bdaddr)
+       if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) ||
+           hdev->set_bdaddr)
                settings |= MGMT_SETTING_CONFIGURATION;
 
        return settings;