Bluetooth: Enable LE Long Term Key Request event only when supported
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 12 Jul 2014 22:29:22 +0000 (00:29 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Sun, 13 Jul 2014 05:49:58 +0000 (08:49 +0300)
The support for LE encryption is optional and with that also the
LE Long Term Key Request event. If encryption is not supported, then
do not bother enabling this event.

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

index ff150e3c7ad1d70194a681471cb63dc3205ed10f..188bfd3d7c43e2078d05e4d2db44bfe76c53c706 100644 (file)
@@ -1644,7 +1644,10 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt)
                u8 events[8];
 
                memset(events, 0, sizeof(events));
-               events[0] = 0x1f;
+               events[0] = 0x0f;
+
+               if (hdev->le_features[0] & HCI_LE_ENCRYPTION)
+                       events[0] |= 0x10;      /* LE Long Term Key Request */
 
                /* If controller supports the Connection Parameters Request
                 * Link Layer Procedure, enable the corresponding event.