aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-07-12 17:36:16 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2014-07-13 01:49:34 -0400
commit0da71f1bf90f259debf50aaaa547e2cc31b5cf67 (patch)
treef50b0a5bd99ba3be72303e2ad9d9c3c99d3009cf /net/bluetooth
parent15a49cca98c3380271ced8db2ea69ee95db5c709 (diff)
Bluetooth: Enable LE encryption events only when supported
The support for LE encryption is optional. When encryption is not supported then also do not enable the encryption related events. This moves the event mask setting to the third initialization stage to ensure that the LE features are available. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_core.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index b29a984f7dd4..ff150e3c7ad1 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1422,14 +1422,17 @@ static void hci_setup_event_mask(struct hci_request *req)
1422 /* Use a different default for LE-only devices */ 1422 /* Use a different default for LE-only devices */
1423 memset(events, 0, sizeof(events)); 1423 memset(events, 0, sizeof(events));
1424 events[0] |= 0x10; /* Disconnection Complete */ 1424 events[0] |= 0x10; /* Disconnection Complete */
1425 events[0] |= 0x80; /* Encryption Change */
1426 events[1] |= 0x08; /* Read Remote Version Information Complete */ 1425 events[1] |= 0x08; /* Read Remote Version Information Complete */
1427 events[1] |= 0x20; /* Command Complete */ 1426 events[1] |= 0x20; /* Command Complete */
1428 events[1] |= 0x40; /* Command Status */ 1427 events[1] |= 0x40; /* Command Status */
1429 events[1] |= 0x80; /* Hardware Error */ 1428 events[1] |= 0x80; /* Hardware Error */
1430 events[2] |= 0x04; /* Number of Completed Packets */ 1429 events[2] |= 0x04; /* Number of Completed Packets */
1431 events[3] |= 0x02; /* Data Buffer Overflow */ 1430 events[3] |= 0x02; /* Data Buffer Overflow */
1432 events[5] |= 0x80; /* Encryption Key Refresh Complete */ 1431
1432 if (hdev->le_features[0] & HCI_LE_ENCRYPTION) {
1433 events[0] |= 0x80; /* Encryption Change */
1434 events[5] |= 0x80; /* Encryption Key Refresh Complete */
1435 }
1433 } 1436 }
1434 1437
1435 if (lmp_inq_rssi_capable(hdev)) 1438 if (lmp_inq_rssi_capable(hdev))
@@ -1482,8 +1485,6 @@ static void hci_init2_req(struct hci_request *req, unsigned long opt)
1482 if (lmp_le_capable(hdev)) 1485 if (lmp_le_capable(hdev))
1483 le_setup(req); 1486 le_setup(req);
1484 1487
1485 hci_setup_event_mask(req);
1486
1487 /* AVM Berlin (31), aka "BlueFRITZ!", doesn't support the read 1488 /* AVM Berlin (31), aka "BlueFRITZ!", doesn't support the read
1488 * local supported commands HCI command. 1489 * local supported commands HCI command.
1489 */ 1490 */
@@ -1611,6 +1612,8 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt)
1611 struct hci_dev *hdev = req->hdev; 1612 struct hci_dev *hdev = req->hdev;
1612 u8 p; 1613 u8 p;
1613 1614
1615 hci_setup_event_mask(req);
1616
1614 /* Some Broadcom based Bluetooth controllers do not support the 1617 /* Some Broadcom based Bluetooth controllers do not support the
1615 * Delete Stored Link Key command. They are clearly indicating its 1618 * Delete Stored Link Key command. They are clearly indicating its
1616 * absence in the bit mask of supported commands. 1619 * absence in the bit mask of supported commands.