]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Bluetooth: mgmt: Clear EIR data when disabling SSP
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 20 Feb 2012 22:52:42 +0000 (00:52 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 20 Feb 2012 23:05:16 +0000 (01:05 +0200)
EIR shouldn't be enabled if SSP isn't enabled. This patch adds the
clearing of EIR data when disabling SSP and restores the data when SSP
is re-enabled.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt.c

index aa0d64040fac51182f7f5ed1e53f264d71e741d1..a5a2a6844aeae43950e9682e70231d189971095b 100644 (file)
@@ -3250,6 +3250,18 @@ int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status)
        return err;
 }
 
+static int clear_eir(struct hci_dev *hdev)
+{
+       struct hci_cp_write_eir cp;
+
+       if (!(hdev->features[6] & LMP_EXT_INQ))
+               return 0;
+
+       memset(&cp, 0, sizeof(cp));
+
+       return hci_send_cmd(hdev, HCI_OP_WRITE_EIR, sizeof(cp), &cp);
+}
+
 int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 status)
 {
        struct cmd_lookup match = { NULL, hdev };
@@ -3268,9 +3280,15 @@ int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 status)
        ev = cpu_to_le32(get_current_settings(hdev));
        err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev), match.sk);
 
-       if (match.sk)
+       if (match.sk) {
                sock_put(match.sk);
 
+               if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags))
+                       update_eir(hdev);
+               else
+                       clear_eir(hdev);
+       }
+
        return err;
 }