Bluetooth: Add flags and setting for Secure Connections support
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 10 Jan 2014 10:07:22 +0000 (02:07 -0800)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 13 Feb 2014 07:51:32 +0000 (09:51 +0200)
The MGMT_SETTING_SECURE_CONN setting is used to track the support and
status for Secure Connections from the management interface. For HCI
based tracking HCI_SC_ENABLED flag is used.

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

index 8d888bc432c6c94263052bc24377bba68b6db09d..0253276e88e405c8d155c28bd09a2e76b0790313 100644 (file)
@@ -122,6 +122,7 @@ enum {
 
        HCI_LE_SCAN,
        HCI_SSP_ENABLED,
+       HCI_SC_ENABLED,
        HCI_HS_ENABLED,
        HCI_LE_ENABLED,
        HCI_ADVERTISING,
index 518c5c84e39a67ef4c9789eacd8d88117bf6ccbd..4ec17dec62e0027b1c7e39aba01d8df2900c7704 100644 (file)
@@ -94,6 +94,7 @@ struct mgmt_rp_read_index_list {
 #define MGMT_SETTING_HS                        0x00000100
 #define MGMT_SETTING_LE                        0x00000200
 #define MGMT_SETTING_ADVERTISING       0x00000400
+#define MGMT_SETTING_SECURE_CONN       0x00000800
 
 #define MGMT_OP_READ_INFO              0x0004
 #define MGMT_READ_INFO_SIZE            0
index a03ca3ca91bfa77e2663a09f90ce2271addb2331..b00fa0253cba6483f98f7decadf76627ca15ce48 100644 (file)
@@ -79,6 +79,7 @@ static const u16 mgmt_commands[] = {
        MGMT_OP_SET_BREDR,
        MGMT_OP_SET_STATIC_ADDRESS,
        MGMT_OP_SET_SCAN_PARAMS,
+       MGMT_OP_SET_SECURE_CONN,
 };
 
 static const u16 mgmt_events[] = {
@@ -376,6 +377,9 @@ static u32 get_supported_settings(struct hci_dev *hdev)
                        settings |= MGMT_SETTING_SSP;
                        settings |= MGMT_SETTING_HS;
                }
+
+               if (lmp_sc_capable(hdev))
+                       settings |= MGMT_SETTING_SECURE_CONN;
        }
 
        if (lmp_le_capable(hdev)) {
@@ -423,6 +427,9 @@ static u32 get_current_settings(struct hci_dev *hdev)
        if (test_bit(HCI_ADVERTISING, &hdev->dev_flags))
                settings |= MGMT_SETTING_ADVERTISING;
 
+       if (test_bit(HCI_SC_ENABLED, &hdev->dev_flags))
+               settings |= MGMT_SETTING_SECURE_CONN;
+
        return settings;
 }