Skip to contentSkip to conversation

Bluetooth: Enable LE Channel Selection Algorithm event

PATCH In review Marcel Holtmann 2 participants 3 messages May 2, 2017

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/3 Bluetooth: Enable LE Channel Selection Algorithm event

If the Channel Selection Algorithm #2 feature is supported, then enable the new LE Channel Selection Algorithm event.

---
 include/net/bluetooth/hci.h | 1 +
 net/bluetooth/hci_core.c    | 8 ++++++++
 2 files changed, 9 insertions(+)
include/net/bluetooth/hci.h +1 -0
index 99aa5e5e3100..dd43cfdd443a 100644
@@ -399,6 +399,7 @@ enum {
 #define HCI_LE_PING			0x10
 #define HCI_LE_DATA_LEN_EXT		0x20
 #define HCI_LE_EXT_SCAN_POLICY		0x80
+#define HCI_LE_CHAN_SEL_ALG2		0x40
 
 /* Connection modes */
 #define HCI_CM_ACTIVE	0x0000
net/bluetooth/hci_core.c +8 -0
index 4a0cac774107..e58b9034afff 100644
@@ -635,6 +635,14 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 						 * Report
 						 */
 
+		/* If the controller supports Channel Selection Algorithm #2
+		 * feature, enable the corresponding event.
+		 */
+		if (hdev->le_features[1] & HCI_LE_CHAN_SEL_ALG2)
+			events[2] |= 0x08;	/* LE Channel Selection
+						 * Algorithm
+						 */
+
 		/* If the controller supports the LE Set Scan Enable command,
 		 * enable the corresponding advertising report event.
 		 */
Signature · 1 line
2.9.3
#1 lore raw

Hi Marcel,

Quoted 26 lines · Marcel Holtmann

If the Channel Selection Algorithm #2 feature is supported, then enable the new LE Channel Selection Algorithm event.

---
 include/net/bluetooth/hci.h | 1 +
 net/bluetooth/hci_core.c    | 8 ++++++++
 2 files changed, 9 insertions(+)
include/net/bluetooth/hci.h +1 -0
index 99aa5e5e3100..dd43cfdd443a 100644
@@ -399,6 +399,7 @@ enum {
 #define HCI_LE_PING                    0x10
 #define HCI_LE_DATA_LEN_EXT            0x20
 #define HCI_LE_EXT_SCAN_POLICY         0x80
+#define HCI_LE_CHAN_SEL_ALG2           0x40
 
 /* Connection modes */
 #define HCI_CM_ACTIVE  0x0000
net/bluetooth/hci_core.c +0 -0
index 4a0cac774107..e58b9034afff 100644

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 644

Quoted 10 lines
net/bluetooth/hci_core.c +7 -0
@@ -635,6 +635,14 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
                                                 * Report
                                                 */
 
+               /* If the controller supports Channel Selection Algorithm #2
+                * feature, enable the corresponding event.
+                */
+               if (hdev->le_features[1] & HCI_LE_CHAN_SEL_ALG2)
+                       events[2] |= 0x08;      /* LE Channel Selection
+                                                * Algorithm
+                                                */

It might look better if you move the comments before the assignment and it may actually fit in a single line. Btw, shoudn't we have a define for 0x08?

Quoted 10 lines
net/bluetooth/hci_core.c +0 -1
                /* If the controller supports the LE Set Scan Enable command,
                 * enable the corresponding advertising report event.
                 */
--

2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Luiz Augusto von Dentz
author maintainer
#2 lore raw

Hi Luiz,

Quoted 29 lines
Quoted 29 lines

If the Channel Selection Algorithm #2 feature is supported, then enable the new LE Channel Selection Algorithm event.

---
include/net/bluetooth/hci.h | 1 +
net/bluetooth/hci_core.c | 8 ++++++++

2 files changed, 9 insertions(+)
include/net/bluetooth/hci.h +1 -0
index 99aa5e5e3100..dd43cfdd443a 100644
@@ -399,6 +399,7 @@ enum {
 #define HCI_LE_PING                    0x10
 #define HCI_LE_DATA_LEN_EXT            0x20
 #define HCI_LE_EXT_SCAN_POLICY         0x80
+#define HCI_LE_CHAN_SEL_ALG2           0x40
 
 /* Connection modes */
 #define HCI_CM_ACTIVE  0x0000
net/bluetooth/hci_core.c +0 -0
index 4a0cac774107..e58b9034afff 100644
@@ -635,6 +635,14 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
                                                * Report
                                                */
 
Quoted 11 lines

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 644

Quoted 7 lines
net/bluetooth/hci_core.c +7 -0
+               /* If the controller supports Channel Selection Algorithm #2
+                * feature, enable the corresponding event.
+                */
+               if (hdev->le_features[1] & HCI_LE_CHAN_SEL_ALG2)
+                       events[2] |= 0x08;      /* LE Channel Selection
+                                                * Algorithm
+                                                */

It might look better if you move the comments before the assignment and it may actually fit in a single line. Btw, shoudn't we have a define for 0x08?

this is in line with how we have done for all other events. So I have no plan to re-format the whole section at this point.

Regards

Marcel