Bluetooth: Read stored link key information when powering on controller
Subsystems (2)
Marcel Holtmann
maintainerPATCH 3/5 Bluetooth: Read stored link key information when powering on controller
The information about max stored link keys and current stored link keys should be read at controller initialization. So issue HCI Read Stored Link Key command with BDADDR_ANY and read_all flag set to 0x01 to retrieve this information.
--- net/bluetooth/hci_core.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/bluetooth/hci_core.c +8 -0
@@ -731,6 +731,14 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt)hci_setup_event_mask (req); +if (hdev->commands[6 ] &0x20 ) { +struct hci_cp_read_stored_link_key cp; + +bacpy (&cp.bdaddr,BDADDR_ANY ); + cp.read_all =0x01 ; +hci_req_add (req,HCI_OP_READ_STORED_LINK_KEY ,sizeof (cp), &cp); + } +/* Some Broadcom based Bluetooth controllers do not support the * Delete Stored Link Key command. They are clearly indicating its * absence in the bit mask of supported commands.
Signature · 1 line
2.1.0
Hi Marcel,
Quoted 15 lines · Marcel Holtmann
The information about max stored link keys and current stored link keys should be read at controller initialization. So issue HCI Read Stored Link Key command with
BDADDR_ANYandread_allflag set to0x01to retrieve this information.Signed-off-by Marcel Holtmann <[email protected]>--- net/bluetooth/hci_core.c | 8 ++++++++ 1 file changed, 8 insertions(+)net/bluetooth/hci_core.c +0
-0
net/bluetooth/hci_core.c static void hci_init3_req(struct hci_request *req, unsigned long opt) · line 740
Quoted 10 lines
net/bluetooth/hci_core.c +7
-0@@ -731,6 +731,14 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt)hci_setup_event_mask (req); +if (hdev->commands[6 ] &0x20 ) { +struct hci_cp_read_stored_link_key cp; + +bacpy (&cp.bdaddr,BDADDR_ANY ); + cp.read_all =0x01 ; +hci_req_add (req,HCI_OP_READ_STORED_LINK_KEY ,sizeof (cp), &cp); + }
Since we're now reading the stored key count before deleting anything, wouldn't it also make sense to move the deleting into init4_req and only do it if hdev->stored_num_keys > 0?
Johan
Marcel Holtmann
maintainerHi Johan,
Quoted 18 lines
Quoted 18 lines
The information about max stored link keys and current stored link keys should be read at controller initialization. So issue HCI Read Stored Link Key command with
BDADDR_ANYandread_allflag set to0x01to retrieve this information.Signed-off-by Marcel Holtmann <[email protected]>---
net/bluetooth/hci_core.c| 8 ++++++++1 file changed, 8 insertions(+)net/bluetooth/hci_core.c +0
-0@@ -731,6 +731,14 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt)hci_setup_event_mask (req);
Quoted 11 lines
net/bluetooth/hci_core.c static void hci_init3_req(struct hci_request *req, unsigned long opt) · line 740
Quoted 7 lines
net/bluetooth/hci_core.c +7
-0+if (hdev->commands[6 ] &0x20 ) { +struct hci_cp_read_stored_link_key cp; + +bacpy (&cp.bdaddr,BDADDR_ANY ); + cp.read_all =0x01 ; +hci_req_add (req,HCI_OP_READ_STORED_LINK_KEY ,sizeof (cp), &cp); + }Since we're now reading the stored key count before deleting anything, wouldn't it also make sense to move the deleting into
init4_reqand only do it ifhdev->stored_num_keys> 0?
most likely it would make sense. I left this for later to get first some test results on how this actually goes and see if we have stored keys in the controller.
Regards
Marcel