diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2014-01-31 14:55:21 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-02-13 02:51:41 -0500 |
commit | b1de97d8c06d9d8d38e85dc5b0cf3630372e702c (patch) | |
tree | 54724335c31ddb14accbe5c73062723925d7577e | |
parent | 9bb3c01fdb2201d405dfff8950145640b2355ec4 (diff) |
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: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r-- | include/net/bluetooth/mgmt.h | 1 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 12 |
2 files changed, 11 insertions, 2 deletions
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index e19049fb6c46..f87f5d784c3b 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -95,6 +95,7 @@ struct mgmt_rp_read_index_list { | |||
95 | #define MGMT_SETTING_LE 0x00000200 | 95 | #define MGMT_SETTING_LE 0x00000200 |
96 | #define MGMT_SETTING_ADVERTISING 0x00000400 | 96 | #define MGMT_SETTING_ADVERTISING 0x00000400 |
97 | #define MGMT_SETTING_SECURE_CONN 0x00000800 | 97 | #define MGMT_SETTING_SECURE_CONN 0x00000800 |
98 | #define MGMT_SETTING_DEBUG_KEYS 0x00001000 | ||
98 | 99 | ||
99 | #define MGMT_OP_READ_INFO 0x0004 | 100 | #define MGMT_OP_READ_INFO 0x0004 |
100 | #define MGMT_READ_INFO_SIZE 0 | 101 | #define MGMT_READ_INFO_SIZE 0 |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 111b1296a2b8..91ffecd1727e 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -364,6 +364,7 @@ static u32 get_supported_settings(struct hci_dev *hdev) | |||
364 | 364 | ||
365 | settings |= MGMT_SETTING_POWERED; | 365 | settings |= MGMT_SETTING_POWERED; |
366 | settings |= MGMT_SETTING_PAIRABLE; | 366 | settings |= MGMT_SETTING_PAIRABLE; |
367 | settings |= MGMT_SETTING_DEBUG_KEYS; | ||
367 | 368 | ||
368 | if (lmp_bredr_capable(hdev)) { | 369 | if (lmp_bredr_capable(hdev)) { |
369 | settings |= MGMT_SETTING_CONNECTABLE; | 370 | settings |= MGMT_SETTING_CONNECTABLE; |
@@ -431,6 +432,9 @@ static u32 get_current_settings(struct hci_dev *hdev) | |||
431 | if (test_bit(HCI_SC_ENABLED, &hdev->dev_flags)) | 432 | if (test_bit(HCI_SC_ENABLED, &hdev->dev_flags)) |
432 | settings |= MGMT_SETTING_SECURE_CONN; | 433 | settings |= MGMT_SETTING_SECURE_CONN; |
433 | 434 | ||
435 | if (test_bit(HCI_DEBUG_KEYS, &hdev->dev_flags)) | ||
436 | settings |= MGMT_SETTING_DEBUG_KEYS; | ||
437 | |||
434 | return settings; | 438 | return settings; |
435 | } | 439 | } |
436 | 440 | ||
@@ -2207,6 +2211,7 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data, | |||
2207 | { | 2211 | { |
2208 | struct mgmt_cp_load_link_keys *cp = data; | 2212 | struct mgmt_cp_load_link_keys *cp = data; |
2209 | u16 key_count, expected_len; | 2213 | u16 key_count, expected_len; |
2214 | bool changed; | ||
2210 | int i; | 2215 | int i; |
2211 | 2216 | ||
2212 | BT_DBG("request for %s", hdev->name); | 2217 | 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 | hci_link_keys_clear(hdev); | 2251 | hci_link_keys_clear(hdev); |
2247 | 2252 | ||
2248 | if (cp->debug_keys) | 2253 | if (cp->debug_keys) |
2249 | set_bit(HCI_DEBUG_KEYS, &hdev->dev_flags); | 2254 | changed = !test_and_set_bit(HCI_DEBUG_KEYS, &hdev->dev_flags); |
2250 | else | 2255 | else |
2251 | clear_bit(HCI_DEBUG_KEYS, &hdev->dev_flags); | 2256 | changed = test_and_clear_bit(HCI_DEBUG_KEYS, &hdev->dev_flags); |
2257 | |||
2258 | if (changed) | ||
2259 | new_settings(hdev, NULL); | ||
2252 | 2260 | ||
2253 | for (i = 0; i < key_count; i++) { | 2261 | for (i = 0; i < key_count; i++) { |
2254 | struct mgmt_link_key_info *key = &cp->keys[i]; | 2262 | struct mgmt_link_key_info *key = &cp->keys[i]; |