* [PATCH] Bluetooth: Fix - During le_conn_timeout disable EXT_ADV
@ 2020-02-18 12:37 Sathish Narsimman
2020-02-18 14:10 ` Marcel Holtmann
0 siblings, 1 reply; 5+ messages in thread
From: Sathish Narsimman @ 2020-02-18 12:37 UTC (permalink / raw)
To: linux-bluetooth, nsathish41; +Cc: Sathish Narsimman
Disabling LE_LEGACY_ADV when LE_EXT_ADV is enabled causes 'command
disallowed . This patch fixes that issue and disables EXT_ADV if
enabled.
Signed-off-by: Sathish Narsimman <sathish.narasimman@intel.com>
---
net/bluetooth/hci_conn.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index a582c676e584..a8d8a876363c 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -481,9 +481,19 @@ static void le_conn_timeout(struct work_struct *work)
* (which doesn't have a timeout of its own).
*/
if (conn->role == HCI_ROLE_SLAVE) {
- u8 enable = 0x00;
- hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
- &enable);
+ if (ext_adv_capable(hdev)) {
+ struct hci_cp_le_set_ext_adv_enable cp;
+
+ cp.enable = 0x00;
+ cp.num_of_sets = 0x00;
+
+ hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE,
+ sizeof(cp), &cp);
+ } else {
+ u8 enable = 0x00;
+ hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
+ sizeof(enable), &enable);
+ }
hci_le_conn_failed(conn, HCI_ERROR_ADVERTISING_TIMEOUT);
return;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: Fix - During le_conn_timeout disable EXT_ADV
2020-02-18 12:37 [PATCH] Bluetooth: Fix - During le_conn_timeout disable EXT_ADV Sathish Narsimman
@ 2020-02-18 14:10 ` Marcel Holtmann
2020-02-18 14:47 ` Sathish Narasimman
0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2020-02-18 14:10 UTC (permalink / raw)
To: Sathish Narsimman; +Cc: linux-bluetooth, Sathish Narsimman
Hi Sathish,
> Disabling LE_LEGACY_ADV when LE_EXT_ADV is enabled causes 'command
> disallowed . This patch fixes that issue and disables EXT_ADV if
> enabled.
>
> Signed-off-by: Sathish Narsimman <sathish.narasimman@intel.com>
> ---
> net/bluetooth/hci_conn.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index a582c676e584..a8d8a876363c 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -481,9 +481,19 @@ static void le_conn_timeout(struct work_struct *work)
> * (which doesn't have a timeout of its own).
> */
> if (conn->role == HCI_ROLE_SLAVE) {
> - u8 enable = 0x00;
> - hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
> - &enable);
> + if (ext_adv_capable(hdev)) {
> + struct hci_cp_le_set_ext_adv_enable cp;
> +
> + cp.enable = 0x00;
> + cp.num_of_sets = 0x00;
> +
> + hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE,
> + sizeof(cp), &cp);
> + } else {
> + u8 enable = 0x00;
> + hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
> + sizeof(enable), &enable);
> + }
hmmm, I wonder if it is better to create a helper function for this.
Regards
Marcel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: Fix - During le_conn_timeout disable EXT_ADV
2020-02-18 14:10 ` Marcel Holtmann
@ 2020-02-18 14:47 ` Sathish Narasimman
2020-02-19 13:53 ` Sathish Narasimman
0 siblings, 1 reply; 5+ messages in thread
From: Sathish Narasimman @ 2020-02-18 14:47 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: Bluez mailing list, Sathish Narsimman
Hi Marcel
On Tue, Feb 18, 2020 at 7:40 PM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Sathish,
>
> > Disabling LE_LEGACY_ADV when LE_EXT_ADV is enabled causes 'command
> > disallowed . This patch fixes that issue and disables EXT_ADV if
> > enabled.
> >
> > Signed-off-by: Sathish Narsimman <sathish.narasimman@intel.com>
> > ---
> > net/bluetooth/hci_conn.c | 16 +++++++++++++---
> > 1 file changed, 13 insertions(+), 3 deletions(-)
> >
> > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> > index a582c676e584..a8d8a876363c 100644
> > --- a/net/bluetooth/hci_conn.c
> > +++ b/net/bluetooth/hci_conn.c
> > @@ -481,9 +481,19 @@ static void le_conn_timeout(struct work_struct *work)
> > * (which doesn't have a timeout of its own).
> > */
> > if (conn->role == HCI_ROLE_SLAVE) {
> > - u8 enable = 0x00;
> > - hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
> > - &enable);
> > + if (ext_adv_capable(hdev)) {
> > + struct hci_cp_le_set_ext_adv_enable cp;
> > +
> > + cp.enable = 0x00;
> > + cp.num_of_sets = 0x00;
> > +
> > + hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE,
> > + sizeof(cp), &cp);
> > + } else {
> > + u8 enable = 0x00;
> > + hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
> > + sizeof(enable), &enable);
> > + }
>
> hmmm, I wonder if it is better to create a helper function for this.
>
> Regards
>
> Marcel
>
let me verify and submit patch with __hci_req_disable_advertising
Regards
Sathish N
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: Fix - During le_conn_timeout disable EXT_ADV
2020-02-18 14:47 ` Sathish Narasimman
@ 2020-02-19 13:53 ` Sathish Narasimman
2020-02-20 7:34 ` Marcel Holtmann
0 siblings, 1 reply; 5+ messages in thread
From: Sathish Narasimman @ 2020-02-19 13:53 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: Bluez mailing list, Sathish Narsimman
Hi Marcel
On Tue, Feb 18, 2020 at 8:17 PM Sathish Narasimman <nsathish41@gmail.com> wrote:
>
> Hi Marcel
>
> On Tue, Feb 18, 2020 at 7:40 PM Marcel Holtmann <marcel@holtmann.org> wrote:
> >
> > Hi Sathish,
> >
> > > Disabling LE_LEGACY_ADV when LE_EXT_ADV is enabled causes 'command
> > > disallowed . This patch fixes that issue and disables EXT_ADV if
> > > enabled.
> > >
> > > Signed-off-by: Sathish Narsimman <sathish.narasimman@intel.com>
> > > ---
> > > net/bluetooth/hci_conn.c | 16 +++++++++++++---
> > > 1 file changed, 13 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> > > index a582c676e584..a8d8a876363c 100644
> > > --- a/net/bluetooth/hci_conn.c
> > > +++ b/net/bluetooth/hci_conn.c
> > > @@ -481,9 +481,19 @@ static void le_conn_timeout(struct work_struct *work)
> > > * (which doesn't have a timeout of its own).
> > > */
> > > if (conn->role == HCI_ROLE_SLAVE) {
> > > - u8 enable = 0x00;
> > > - hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
> > > - &enable);
> > > + if (ext_adv_capable(hdev)) {
> > > + struct hci_cp_le_set_ext_adv_enable cp;
> > > +
> > > + cp.enable = 0x00;
> > > + cp.num_of_sets = 0x00;
> > > +
> > > + hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE,
> > > + sizeof(cp), &cp);
> > > + } else {
> > > + u8 enable = 0x00;
> > > + hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
> > > + sizeof(enable), &enable);
> > > + }
> >
> > hmmm, I wonder if it is better to create a helper function for this.
> >
> > Regards
> >
> > Marcel
> >
>
> let me verify and submit patch with __hci_req_disable_advertising
>
> Regards
> Sathish N
calling __hci_req_disable_advertising is not working. the command is
not getting executed
I hope the below method is fine? where it works
+static void le_disable_advertising(struct hci_dev *hdev)
+{
+ if (ext_adv_capable(hdev)) {
+ struct hci_cp_le_set_ext_adv_enable cp;
+ cp.enable = 0x00;
+ cp.num_of_sets = 0x00;
+
+ hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE, sizeof(cp),
+ &cp);
+ } else {
+ u8 enable = 0x00;
+ hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
+ sizeof(enable), &enable);
+ }
+
+}
Regards
Sathish N
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: Fix - During le_conn_timeout disable EXT_ADV
2020-02-19 13:53 ` Sathish Narasimman
@ 2020-02-20 7:34 ` Marcel Holtmann
0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2020-02-20 7:34 UTC (permalink / raw)
To: Sathish Narasimman; +Cc: Bluez mailing list, Sathish Narsimman
Hi Sathish,
>>>> Disabling LE_LEGACY_ADV when LE_EXT_ADV is enabled causes 'command
>>>> disallowed . This patch fixes that issue and disables EXT_ADV if
>>>> enabled.
>>>>
>>>> Signed-off-by: Sathish Narsimman <sathish.narasimman@intel.com>
>>>> ---
>>>> net/bluetooth/hci_conn.c | 16 +++++++++++++---
>>>> 1 file changed, 13 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
>>>> index a582c676e584..a8d8a876363c 100644
>>>> --- a/net/bluetooth/hci_conn.c
>>>> +++ b/net/bluetooth/hci_conn.c
>>>> @@ -481,9 +481,19 @@ static void le_conn_timeout(struct work_struct *work)
>>>> * (which doesn't have a timeout of its own).
>>>> */
>>>> if (conn->role == HCI_ROLE_SLAVE) {
>>>> - u8 enable = 0x00;
>>>> - hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
>>>> - &enable);
>>>> + if (ext_adv_capable(hdev)) {
>>>> + struct hci_cp_le_set_ext_adv_enable cp;
>>>> +
>>>> + cp.enable = 0x00;
>>>> + cp.num_of_sets = 0x00;
>>>> +
>>>> + hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE,
>>>> + sizeof(cp), &cp);
>>>> + } else {
>>>> + u8 enable = 0x00;
>>>> + hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
>>>> + sizeof(enable), &enable);
>>>> + }
>>>
>>> hmmm, I wonder if it is better to create a helper function for this.
>>>
>>> Regards
>>>
>>> Marcel
>>>
>>
>> let me verify and submit patch with __hci_req_disable_advertising
>>
>> Regards
>> Sathish N
>
> calling __hci_req_disable_advertising is not working. the command is
> not getting executed
> I hope the below method is fine? where it works
>
> +static void le_disable_advertising(struct hci_dev *hdev)
> +{
> + if (ext_adv_capable(hdev)) {
> + struct hci_cp_le_set_ext_adv_enable cp;
> + cp.enable = 0x00;
> + cp.num_of_sets = 0x00;
> +
> + hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE, sizeof(cp),
> + &cp);
> + } else {
> + u8 enable = 0x00;
> + hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
> + sizeof(enable), &enable);
> + }
> +
> +}
at first glance this looks fine.
Regards
Marcel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-02-20 7:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-18 12:37 [PATCH] Bluetooth: Fix - During le_conn_timeout disable EXT_ADV Sathish Narsimman
2020-02-18 14:10 ` Marcel Holtmann
2020-02-18 14:47 ` Sathish Narasimman
2020-02-19 13:53 ` Sathish Narasimman
2020-02-20 7:34 ` 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.