Commit b1de97d8 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Johan Hedberg

Bluetooth: Add management setting for use of debug keys

When the controller has been enabled to allow usage of debug keys, then
clearly identify that in the current settings information.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 9bb3c01f
...@@ -95,6 +95,7 @@ struct mgmt_rp_read_index_list { ...@@ -95,6 +95,7 @@ struct mgmt_rp_read_index_list {
#define MGMT_SETTING_LE 0x00000200 #define MGMT_SETTING_LE 0x00000200
#define MGMT_SETTING_ADVERTISING 0x00000400 #define MGMT_SETTING_ADVERTISING 0x00000400
#define MGMT_SETTING_SECURE_CONN 0x00000800 #define MGMT_SETTING_SECURE_CONN 0x00000800
#define MGMT_SETTING_DEBUG_KEYS 0x00001000
#define MGMT_OP_READ_INFO 0x0004 #define MGMT_OP_READ_INFO 0x0004
#define MGMT_READ_INFO_SIZE 0 #define MGMT_READ_INFO_SIZE 0
......
...@@ -364,6 +364,7 @@ static u32 get_supported_settings(struct hci_dev *hdev) ...@@ -364,6 +364,7 @@ static u32 get_supported_settings(struct hci_dev *hdev)
settings |= MGMT_SETTING_POWERED; settings |= MGMT_SETTING_POWERED;
settings |= MGMT_SETTING_PAIRABLE; settings |= MGMT_SETTING_PAIRABLE;
settings |= MGMT_SETTING_DEBUG_KEYS;
if (lmp_bredr_capable(hdev)) { if (lmp_bredr_capable(hdev)) {
settings |= MGMT_SETTING_CONNECTABLE; settings |= MGMT_SETTING_CONNECTABLE;
...@@ -431,6 +432,9 @@ static u32 get_current_settings(struct hci_dev *hdev) ...@@ -431,6 +432,9 @@ static u32 get_current_settings(struct hci_dev *hdev)
if (test_bit(HCI_SC_ENABLED, &hdev->dev_flags)) if (test_bit(HCI_SC_ENABLED, &hdev->dev_flags))
settings |= MGMT_SETTING_SECURE_CONN; settings |= MGMT_SETTING_SECURE_CONN;
if (test_bit(HCI_DEBUG_KEYS, &hdev->dev_flags))
settings |= MGMT_SETTING_DEBUG_KEYS;
return settings; return settings;
} }
...@@ -2207,6 +2211,7 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data, ...@@ -2207,6 +2211,7 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data,
{ {
struct mgmt_cp_load_link_keys *cp = data; struct mgmt_cp_load_link_keys *cp = data;
u16 key_count, expected_len; u16 key_count, expected_len;
bool changed;
int i; int i;
BT_DBG("request for %s", hdev->name); BT_DBG("request for %s", hdev->name);
...@@ -2246,9 +2251,12 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data, ...@@ -2246,9 +2251,12 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data,
hci_link_keys_clear(hdev); hci_link_keys_clear(hdev);
if (cp->debug_keys) if (cp->debug_keys)
set_bit(HCI_DEBUG_KEYS, &hdev->dev_flags); changed = !test_and_set_bit(HCI_DEBUG_KEYS, &hdev->dev_flags);
else else
clear_bit(HCI_DEBUG_KEYS, &hdev->dev_flags); changed = test_and_clear_bit(HCI_DEBUG_KEYS, &hdev->dev_flags);
if (changed)
new_settings(hdev, NULL);
for (i = 0; i < key_count; i++) { for (i = 0; i < key_count; i++) {
struct mgmt_link_key_info *key = &cp->keys[i]; struct mgmt_link_key_info *key = &cp->keys[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment