linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/4] Bluetooth: Make LE only events conditional on supported commands
@ 2015-11-01  8:39 Marcel Holtmann
  2015-11-01 13:38 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Marcel Holtmann @ 2015-11-01  8:39 UTC (permalink / raw)
  To: linux-bluetooth

For the LE only controllers, there are events that should not be enabled
if the corresponding command is not supported.

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

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index db423657935a..ece86ed1249b 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -534,13 +534,20 @@ static void hci_setup_event_mask(struct hci_request *req)
 	} else {
 		/* Use a different default for LE-only devices */
 		memset(events, 0, sizeof(events));
-		events[0] |= 0x10; /* Disconnection Complete */
-		events[1] |= 0x08; /* Read Remote Version Information Complete */
 		events[1] |= 0x20; /* Command Complete */
 		events[1] |= 0x40; /* Command Status */
 		events[1] |= 0x80; /* Hardware Error */
-		events[2] |= 0x04; /* Number of Completed Packets */
-		events[3] |= 0x02; /* Data Buffer Overflow */
+
+		if (hdev->commands[0] & 0x20) {
+			events[0] |= 0x10; /* Disconnection Complete */
+			events[2] |= 0x04; /* Number of Completed Packets */
+			events[3] |= 0x02; /* Data Buffer Overflow */
+		}
+
+		if (hdev->commands[2] & 0x80)
+			events[1] |= 0x08; /* Read Remote Version Information
+					    * Complete
+					    */
 
 		if (hdev->le_features[0] & HCI_LE_ENCRYPTION) {
 			events[0] |= 0x80; /* Encryption Change */
-- 
2.4.3


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

* Re: [PATCH 3/4] Bluetooth: Make LE only events conditional on supported commands
  2015-11-01  8:39 [PATCH 3/4] Bluetooth: Make LE only events conditional on supported commands Marcel Holtmann
@ 2015-11-01 13:38 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2015-11-01 13:38 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Sun, Nov 01, 2015, Marcel Holtmann wrote:
> For the LE only controllers, there are events that should not be enabled
> if the corresponding command is not supported.
> 
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  net/bluetooth/hci_core.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)

I've applied patches 1, 2 and 4 from this set, but could you add some
clarifications to this one:

> @@ -534,13 +534,20 @@ static void hci_setup_event_mask(struct hci_request *req)
>  	} else {
>  		/* Use a different default for LE-only devices */
>  		memset(events, 0, sizeof(events));
> -		events[0] |= 0x10; /* Disconnection Complete */
> -		events[1] |= 0x08; /* Read Remote Version Information Complete */
>  		events[1] |= 0x20; /* Command Complete */
>  		events[1] |= 0x40; /* Command Status */
>  		events[1] |= 0x80; /* Hardware Error */
> -		events[2] |= 0x04; /* Number of Completed Packets */
> -		events[3] |= 0x02; /* Data Buffer Overflow */
> +
> +		if (hdev->commands[0] & 0x20) {
> +			events[0] |= 0x10; /* Disconnection Complete */
> +			events[2] |= 0x04; /* Number of Completed Packets */
> +			events[3] |= 0x02; /* Data Buffer Overflow */
> +		}

Which exact command is "hdev->commands[0] & 0x20"? Could you add a code
comment here to make it clear.

> +		if (hdev->commands[2] & 0x80)
> +			events[1] |= 0x08; /* Read Remote Version Information
> +					    * Complete
> +					    */

I assume this one is HCI_Read_Remote_Version_Information, but might be
good to add a code comment for it too.

Johan

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

end of thread, other threads:[~2015-11-01 13:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-01  8:39 [PATCH 3/4] Bluetooth: Make LE only events conditional on supported commands Marcel Holtmann
2015-11-01 13:38 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).