Skip to content

Commit 3769972

Browse files
jhedbergholtmann
authored andcommitted
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>
1 parent 58e9293 commit 3769972

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎include/net/bluetooth/hci.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ enum {
125125
HCI_PAIRABLE,
126126
HCI_SERVICE_CACHE,
127127
HCI_KEEP_DEBUG_KEYS,
128+
HCI_USE_DEBUG_KEYS,
128129
HCI_UNREGISTER,
129130
HCI_USER_CHANNEL,
130131

‎net/bluetooth/mgmt.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,10 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
18771877
goto failed;
18781878
}
18791879

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+
18801884
err = hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &cp->val);
18811885
if (err < 0) {
18821886
mgmt_pending_remove(cmd);
@@ -5784,10 +5788,14 @@ void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status)
57845788

57855789
hci_req_init(&req, hdev);
57865790

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);
57885795
update_eir(&req);
5789-
else
5796+
} else {
57905797
clear_eir(&req);
5798+
}
57915799

57925800
hci_req_run(&req, NULL);
57935801
}

0 commit comments

Comments
 (0)