* [PATCH 1/3] Bluetooth: Enable LE Channel Selection Algorithm event
@ 2017-05-02 6:54 Marcel Holtmann
2017-05-02 7:37 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2017-05-02 6:54 UTC (permalink / raw)
To: linux-bluetooth
If the Channel Selection Algorithm #2 feature is supported, then enable
the new LE Channel Selection Algorithm event.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
include/net/bluetooth/hci.h | 1 +
net/bluetooth/hci_core.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 99aa5e5e3100..dd43cfdd443a 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -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
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 4a0cac774107..e58b9034afff 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -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.
*/
--
2.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/3] Bluetooth: Enable LE Channel Selection Algorithm event
2017-05-02 6:54 [PATCH 1/3] Bluetooth: Enable LE Channel Selection Algorithm event Marcel Holtmann
@ 2017-05-02 7:37 ` Luiz Augusto von Dentz
2017-05-02 7:48 ` Marcel Holtmann
0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2017-05-02 7:37 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org
Hi Marcel,
On Tue, May 2, 2017 at 9:54 AM, Marcel Holtmann <marcel@holtmann.org> wrote:
> If the Channel Selection Algorithm #2 feature is supported, then enable
> the new LE Channel Selection Algorithm event.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> include/net/bluetooth/hci.h | 1 +
> net/bluetooth/hci_core.c | 8 ++++++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index 99aa5e5e3100..dd43cfdd443a 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -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
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 4a0cac774107..e58b9034afff 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -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?
> /* 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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 1/3] Bluetooth: Enable LE Channel Selection Algorithm event
2017-05-02 7:37 ` Luiz Augusto von Dentz
@ 2017-05-02 7:48 ` Marcel Holtmann
0 siblings, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2017-05-02 7:48 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org
Hi Luiz,
>> If the Channel Selection Algorithm #2 feature is supported, then enable
>> the new LE Channel Selection Algorithm event.
>>
>> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
>> ---
>> include/net/bluetooth/hci.h | 1 +
>> net/bluetooth/hci_core.c | 8 ++++++++
>> 2 files changed, 9 insertions(+)
>>
>> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
>> index 99aa5e5e3100..dd43cfdd443a 100644
>> --- a/include/net/bluetooth/hci.h
>> +++ b/include/net/bluetooth/hci.h
>> @@ -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
>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
>> index 4a0cac774107..e58b9034afff 100644
>> --- a/net/bluetooth/hci_core.c
>> +++ b/net/bluetooth/hci_core.c
>> @@ -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?
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-02 7:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-02 6:54 [PATCH 1/3] Bluetooth: Enable LE Channel Selection Algorithm event Marcel Holtmann
2017-05-02 7:37 ` Luiz Augusto von Dentz
2017-05-02 7:48 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox