Skip to contentSkip to conversation

Adjust timeout LE

PATCH In review Marco Sinigaglia 2 participants 3 messages Mar 2, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Adjust timeout LE

The hci_send_req 100ms timeout is not enough when the chip is in deep sleep. This patch increases it to 1000ms.

From: Marco Sinigaglia, [email protected]
---

lib/hci.c         |    6 +++---
tools/hciconfig.c |    2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
lib/hci.c +3 -3
index 02fc0cf..96fafe1 100644
@@ -2753,7 +2753,7 @@ int hci_le_set_scan_enable(int dd, uint8_t enable, uint8_t filter_dup)
        rq.rparam = &status;
        rq.rlen = 1;
 
-       if (hci_send_req(dd, &rq, 100) < 0)
+       if (hci_send_req(dd, &rq, 1000) < 0)
                return -1;
 
        if (status) {
@@ -2787,7 +2787,7 @@ int hci_le_set_scan_parameters(int dd, uint8_t type,
        rq.rparam = &status;
        rq.rlen = 1;
 
-       if (hci_send_req(dd, &rq, 100) < 0)
+       if (hci_send_req(dd, &rq, 1000) < 0)
                return -1;
 
        if (status) {
@@ -2815,7 +2815,7 @@ int hci_le_set_advertise_enable(int dd, uint8_t enable)
        rq.rparam = &status;
        rq.rlen = 1;
 
-       if (hci_send_req(dd, &rq, 100) < 0)
+       if (hci_send_req(dd, &rq, 1000) < 0)
                return -1;
 
        if (status) {
tools/hciconfig.c +1 -1
index 05a8910..aa6d009 100644
@@ -268,7 +268,7 @@ static void cmd_le_adv(int ctl, int hdev, char *opt)
        rq.rparam = &status;
        rq.rlen = 1;
 
-       ret = hci_send_req(dd, &rq, 100);
+       ret = hci_send_req(dd, &rq, 1000);
 
        hci_close_dev(dd);
 

Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom

#1 lore raw

Hi Marco,

Quoted 81 lines

The hci_send_req 100ms
timeout is not enough when
the chip is in deep
sleep.
This patch increases it to
1000ms.

From: Marco Sinigaglia,
[email protected]
---
lib/hci.c | 6
+++---
tools/hciconfig.c | 2 +-

2 files changed, 4

insertions(+), 4 deletions(-
)

lib/hci.c +0 -0
index 02fc0cf..96fafe1

100644

lib/hci.c +0 -0
@@ -2753,7 +2753,7 @@ int

hci_le_set_scan_enable(int
dd, uint8_t enable,
uint8_t filter_dup)
rq.rparam =

&status;
        rq.rlen = 1;

- if (hci_send_req(dd,
&rq, 100) < 0)
+ if (hci_send_req(dd,
&rq, 1000) < 0)

                return -1;

        if (status) {
lib/hci.c +0 -0
@@ -2787,7 +2787,7 @@ int

hci_le_set_scan_parameters(i
nt dd, uint8_t type,
rq.rparam =

&status;
        rq.rlen = 1;

- if (hci_send_req(dd,
&rq, 100) < 0)
+ if (hci_send_req(dd,
&rq, 1000) < 0)

                return -1;

        if (status) {
lib/hci.c +0 -0
@@ -2815,7 +2815,7 @@ int

hci_le_set_advertise_enable(
int dd, uint8_t
enable)
rq.rparam =

&status;
        rq.rlen = 1;

- if (hci_send_req(dd,
&rq, 100) < 0)
+ if (hci_send_req(dd,
&rq, 1000) < 0)

                return -1;

        if (status) {

diff --git
a/tools/hciconfig.c
b/tools/hciconfig.c
index 05a8910..aa6d009
100644

tools/hciconfig.c +0 -0
@@ -268,7 +268,7 @@ static

void cmd_le_adv(int ctl, int
hdev, char *opt)
rq.rparam =

&status;
        rq.rlen = 1;
Quoted 6 lines

- ret =
hci_send_req(dd, &rq, 100);
+ ret =
hci_send_req(dd, &rq, 1000);

        hci_close_dev(dd);

Shouldn't the to parameter be passed to hci_le_set_scan_enable(...) rather than hard-coding it and passing it to hci_send_req(as 1000)?
I see that as the logical way for all hci_* functions in hci.c that eventually call hci_send_req(). hci_le_set_scan_parameters and few others yet don't have to as input argument and should be patched suitably ...

Thanks,
Arun

#2 lore raw

Hi Arun,

Quoted 95 lines · Arun Kumar SINGH

Hi Marco,

Quoted 81 lines

The hci_send_req 100ms
timeout is not enough when
the chip is in deep
sleep.
This patch increases it to
1000ms.

From: Marco Sinigaglia,
[email protected]
---
lib/hci.c | 6
+++---
tools/hciconfig.c | 2 +-

2 files changed, 4

insertions(+), 4 deletions(-
)

lib/hci.c +0 -0
index 02fc0cf..96fafe1

100644

lib/hci.c +0 -0
@@ -2753,7 +2753,7 @@ int

hci_le_set_scan_enable(int
dd, uint8_t enable,
uint8_t filter_dup)
rq.rparam =

&status;
         rq.rlen = 1;

- if (hci_send_req(dd,
&rq, 100)< 0)
+ if (hci_send_req(dd,
&rq, 1000)< 0)

                 return -1;

         if (status) {
lib/hci.c +0 -0
@@ -2787,7 +2787,7 @@ int

hci_le_set_scan_parameters(i
nt dd, uint8_t type,
rq.rparam =

&status;
         rq.rlen = 1;

- if (hci_send_req(dd,
&rq, 100)< 0)
+ if (hci_send_req(dd,
&rq, 1000)< 0)

                 return -1;

         if (status) {
lib/hci.c +0 -0
@@ -2815,7 +2815,7 @@ int

hci_le_set_advertise_enable(
int dd, uint8_t
enable)
rq.rparam =

&status;
         rq.rlen = 1;

- if (hci_send_req(dd,
&rq, 100)< 0)
+ if (hci_send_req(dd,
&rq, 1000)< 0)

                 return -1;

         if (status) {

diff --git
a/tools/hciconfig.c
b/tools/hciconfig.c
index 05a8910..aa6d009
100644

tools/hciconfig.c +0 -0
@@ -268,7 +268,7 @@ static

void cmd_le_adv(int ctl, int
hdev, char *opt)
rq.rparam =

&status;
         rq.rlen = 1;
Quoted 6 lines

- ret =
hci_send_req(dd,&rq, 100);
+ ret =
hci_send_req(dd,&rq, 1000);

         hci_close_dev(dd);

Shouldn't the to parameter be passed to hci_le_set_scan_enable(...) rather than hard-coding it and passing it to hci_send_req(as 1000)?
I see that as the logical way for all hci_* functions in hci.c that eventually call hci_send_req(). hci_le_set_scan_parameters and few others yet don't have to as input argument and should be patched suitably ...

Quoted 5 lines

Thanks,
Arun

To report this email as spam click https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg== .

I do agree Arun, I will change the code as you suggest.

Cheers
Marco

Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom