All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/5] Bluetooth: Read stored link key information when powering on controller
@ 2015-01-11 21:44 Marcel Holtmann
  2015-01-12  9:06 ` Johan Hedberg
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2015-01-11 21:44 UTC (permalink / raw)
  To: linux-bluetooth

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.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/bluetooth/hci_core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index ba0d1fdccbd9..96572a48948e 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -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.
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/5] Bluetooth: Read stored link key information when powering on controller
  2015-01-11 21:44 [PATCH 3/5] Bluetooth: Read stored link key information when powering on controller Marcel Holtmann
@ 2015-01-12  9:06 ` Johan Hedberg
  2015-01-12 17:12   ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Hedberg @ 2015-01-12  9:06 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Sun, Jan 11, 2015, Marcel Holtmann wrote:
> 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.
> 
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  net/bluetooth/hci_core.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index ba0d1fdccbd9..96572a48948e 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/5] Bluetooth: Read stored link key information when powering on controller
  2015-01-12  9:06 ` Johan Hedberg
@ 2015-01-12 17:12   ` Marcel Holtmann
  0 siblings, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2015-01-12 17:12 UTC (permalink / raw)
  To: Johan Hedberg; +Cc: linux-bluetooth

Hi Johan,

>> 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.
>> 
>> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
>> ---
>> net/bluetooth/hci_core.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>> 
>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
>> index ba0d1fdccbd9..96572a48948e 100644
>> --- a/net/bluetooth/hci_core.c
>> +++ b/net/bluetooth/hci_core.c
>> @@ -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?

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-12 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-11 21:44 [PATCH 3/5] Bluetooth: Read stored link key information when powering on controller Marcel Holtmann
2015-01-12  9:06 ` Johan Hedberg
2015-01-12 17:12   ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.