summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-06-24 07:00:27 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-07-03 11:42:46 -0400
commit3769972badcd542913c460ca2834312cdff9f16c (patch)
tree3a9d1dde744e33b909ecd75372bbf4c8175360bd /net/bluetooth/mgmt.c
parent58e9293c4e18b9b5f52822e7cbce589c70920721 (diff)
Bluetooth: Add a new HCI_USE_DEBUG_KEYS flag
To pave the way for actively using debug keys for pairing this patch adds a new HCI_USE_DEBUG_KEYS flag for the purpose. When the flag is set we issue a HCI_Write_SSP_Debug mode whenever HCI_Write_SSP_Mode(0x01) has been issued as well as before issuing a HCI_Write_SSP_Mode(0x00) command. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 747746b0d2c4..69afbb2df133 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1877,6 +1877,10 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
1877 goto failed; 1877 goto failed;
1878 } 1878 }
1879 1879
1880 if (!cp->val && test_bit(HCI_USE_DEBUG_KEYS, &hdev->dev_flags))
1881 hci_send_cmd(hdev, HCI_OP_WRITE_SSP_DEBUG_MODE,
1882 sizeof(cp->val), &cp->val);
1883
1880 err = hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &cp->val); 1884 err = hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &cp->val);
1881 if (err < 0) { 1885 if (err < 0) {
1882 mgmt_pending_remove(cmd); 1886 mgmt_pending_remove(cmd);
@@ -5784,10 +5788,14 @@ void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status)
5784 5788
5785 hci_req_init(&req, hdev); 5789 hci_req_init(&req, hdev);
5786 5790
5787 if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) 5791 if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) {
5792 if (test_bit(HCI_USE_DEBUG_KEYS, &hdev->dev_flags))
5793 hci_req_add(&req, HCI_OP_WRITE_SSP_DEBUG_MODE,
5794 sizeof(enable), &enable);
5788 update_eir(&req); 5795 update_eir(&req);
5789 else 5796 } else {
5790 clear_eir(&req); 5797 clear_eir(&req);
5798 }
5791 5799
5792 hci_req_run(&req, NULL); 5800 hci_req_run(&req, NULL);
5793} 5801}