* [PATCH Bluez v2] adapter: Fix discovery trigger for 0 second delay
@ 2021-03-12 16:50 Frédéric Danis
2021-03-12 18:28 ` Luiz Augusto von Dentz
2021-03-15 22:36 ` [Bluez,v2] " bluez.test.bot
0 siblings, 2 replies; 6+ messages in thread
From: Frédéric Danis @ 2021-03-12 16:50 UTC (permalink / raw)
To: linux-bluetooth
When calling `StartDiscovery` the effective start can take around 10 ms or
up to 700 ms.
g_timeout_add_seconds() call doesn't ensure the time for the first call of
the timer if the delay is less or equal to 1 second.
---
v2: Fix issue founs by CI
src/adapter.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/adapter.c b/src/adapter.c
index cc0849f99..3078ce1a8 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1797,6 +1797,13 @@ static void trigger_start_discovery(struct btd_adapter *adapter, guint delay)
if (!btd_adapter_get_powered(adapter))
return;
+ if (!delay) {
+ adapter->discovery_idle_timeout = g_idle_add(
+ start_discovery_timeout,
+ adapter);
+ return;
+ }
+
adapter->discovery_idle_timeout = g_timeout_add_seconds(delay,
start_discovery_timeout, adapter);
}
--
2.18.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH Bluez v2] adapter: Fix discovery trigger for 0 second delay
2021-03-12 16:50 [PATCH Bluez v2] adapter: Fix discovery trigger for 0 second delay Frédéric Danis
@ 2021-03-12 18:28 ` Luiz Augusto von Dentz
2021-03-12 19:09 ` Frédéric Danis
2021-03-15 22:36 ` [Bluez,v2] " bluez.test.bot
1 sibling, 1 reply; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2021-03-12 18:28 UTC (permalink / raw)
To: Frédéric Danis; +Cc: linux-bluetooth
Hi Frédéric,
On Fri, Mar 12, 2021 at 8:53 AM Frédéric Danis
<frederic.danis@collabora.com> wrote:
>
> When calling `StartDiscovery` the effective start can take around 10 ms or
> up to 700 ms.
> g_timeout_add_seconds() call doesn't ensure the time for the first call of
> the timer if the delay is less or equal to 1 second.
Interesting, I always thought that 0 would be handle just as idle and
not round up to the next timeout.
> ---
> v2: Fix issue founs by CI
>
> src/adapter.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index cc0849f99..3078ce1a8 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -1797,6 +1797,13 @@ static void trigger_start_discovery(struct btd_adapter *adapter, guint delay)
> if (!btd_adapter_get_powered(adapter))
> return;
>
> + if (!delay) {
> + adapter->discovery_idle_timeout = g_idle_add(
> + start_discovery_timeout,
> + adapter);
> + return;
> + }
> +
> adapter->discovery_idle_timeout = g_timeout_add_seconds(delay,
> start_discovery_timeout, adapter);
Maybe we should have a wrapper function for g_timeout_add_seconds
since I suspect there might be other instances of
g_timeout_add_seconds with 0 delay.
> }
> --
> 2.18.0
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH Bluez v2] adapter: Fix discovery trigger for 0 second delay
2021-03-12 18:28 ` Luiz Augusto von Dentz
@ 2021-03-12 19:09 ` Frédéric Danis
2021-03-12 19:37 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 6+ messages in thread
From: Frédéric Danis @ 2021-03-12 19:09 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
On 12/03/2021 19:28, Luiz Augusto von Dentz wrote:
> Hi Frédéric,
>
> On Fri, Mar 12, 2021 at 8:53 AM Frédéric Danis
> <frederic.danis@collabora.com> wrote:
>> When calling `StartDiscovery` the effective start can take around 10 ms or
>> up to 700 ms.
>> g_timeout_add_seconds() call doesn't ensure the time for the first call of
>> the timer if the delay is less or equal to 1 second.
> Interesting, I always thought that 0 would be handle just as idle and
> not round up to the next timeout.
>
>> ---
>> v2: Fix issue founs by CI
>>
>> src/adapter.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/src/adapter.c b/src/adapter.c
>> index cc0849f99..3078ce1a8 100644
>> --- a/src/adapter.c
>> +++ b/src/adapter.c
>> @@ -1797,6 +1797,13 @@ static void trigger_start_discovery(struct btd_adapter *adapter, guint delay)
>> if (!btd_adapter_get_powered(adapter))
>> return;
>>
>> + if (!delay) {
>> + adapter->discovery_idle_timeout = g_idle_add(
>> + start_discovery_timeout,
>> + adapter);
>> + return;
>> + }
>> +
>> adapter->discovery_idle_timeout = g_timeout_add_seconds(delay,
>> start_discovery_timeout, adapter);
> Maybe we should have a wrapper function for g_timeout_add_seconds
> since I suspect there might be other instances of
> g_timeout_add_seconds with 0 delay.
Ok
Is adding a timeout_add_seconds() function to src/shared/timeout.h the
right place?
Fred
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH Bluez v2] adapter: Fix discovery trigger for 0 second delay
2021-03-12 19:09 ` Frédéric Danis
@ 2021-03-12 19:37 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2021-03-12 19:37 UTC (permalink / raw)
To: Frédéric Danis; +Cc: linux-bluetooth
Hi Frédéric,
On Fri, Mar 12, 2021 at 11:09 AM Frédéric Danis
<frederic.danis@collabora.com> wrote:
>
> Hi Luiz,
>
> On 12/03/2021 19:28, Luiz Augusto von Dentz wrote:
> > Hi Frédéric,
> >
> > On Fri, Mar 12, 2021 at 8:53 AM Frédéric Danis
> > <frederic.danis@collabora.com> wrote:
> >> When calling `StartDiscovery` the effective start can take around 10 ms or
> >> up to 700 ms.
> >> g_timeout_add_seconds() call doesn't ensure the time for the first call of
> >> the timer if the delay is less or equal to 1 second.
> > Interesting, I always thought that 0 would be handle just as idle and
> > not round up to the next timeout.
> >
> >> ---
> >> v2: Fix issue founs by CI
> >>
> >> src/adapter.c | 7 +++++++
> >> 1 file changed, 7 insertions(+)
> >>
> >> diff --git a/src/adapter.c b/src/adapter.c
> >> index cc0849f99..3078ce1a8 100644
> >> --- a/src/adapter.c
> >> +++ b/src/adapter.c
> >> @@ -1797,6 +1797,13 @@ static void trigger_start_discovery(struct btd_adapter *adapter, guint delay)
> >> if (!btd_adapter_get_powered(adapter))
> >> return;
> >>
> >> + if (!delay) {
> >> + adapter->discovery_idle_timeout = g_idle_add(
> >> + start_discovery_timeout,
> >> + adapter);
> >> + return;
> >> + }
> >> +
> >> adapter->discovery_idle_timeout = g_timeout_add_seconds(delay,
> >> start_discovery_timeout, adapter);
> > Maybe we should have a wrapper function for g_timeout_add_seconds
> > since I suspect there might be other instances of
> > g_timeout_add_seconds with 0 delay.
>
> Ok
> Is adding a timeout_add_seconds() function to src/shared/timeout.h the
> right place?
Yep, that should be the right place.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [Bluez,v2] adapter: Fix discovery trigger for 0 second delay
2021-03-12 16:50 [PATCH Bluez v2] adapter: Fix discovery trigger for 0 second delay Frédéric Danis
2021-03-12 18:28 ` Luiz Augusto von Dentz
@ 2021-03-15 22:36 ` bluez.test.bot
1 sibling, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2021-03-15 22:36 UTC (permalink / raw)
To: linux-bluetooth, frederic.danis
[-- Attachment #1: Type: text/plain, Size: 557 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=447189
---Test result---
##############################
Test: CheckPatch - PASS
##############################
Test: CheckGitLint - PASS
##############################
Test: CheckBuild - PASS
##############################
Test: MakeCheck - PASS
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH Bluez v2] adapter: Fix discovery trigger for 0 second delay
@ 2021-03-12 11:59
0 siblings, 0 replies; 6+ messages in thread
From: @ 2021-03-12 11:59 UTC (permalink / raw)
To: linux-bluetooth
From: Frédéric Danis <frederic.danis@collabora.com>
When calling `StartDiscovery` the effective start can take around 10 ms or
up to 700 ms.
g_timeout_add_seconds() call doesn't ensure the time for the first call of
the timer if the delay is less or equal to 1 second.
---
v2: Fix issue founs by CI
src/adapter.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/adapter.c b/src/adapter.c
index cc0849f99..3078ce1a8 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1797,6 +1797,13 @@ static void trigger_start_discovery(struct btd_adapter *adapter, guint delay)
if (!btd_adapter_get_powered(adapter))
return;
+ if (!delay) {
+ adapter->discovery_idle_timeout = g_idle_add(
+ start_discovery_timeout,
+ adapter);
+ return;
+ }
+
adapter->discovery_idle_timeout = g_timeout_add_seconds(delay,
start_discovery_timeout, adapter);
}
--
2.18.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-03-15 22:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12 16:50 [PATCH Bluez v2] adapter: Fix discovery trigger for 0 second delay Frédéric Danis
2021-03-12 18:28 ` Luiz Augusto von Dentz
2021-03-12 19:09 ` Frédéric Danis
2021-03-12 19:37 ` Luiz Augusto von Dentz
2021-03-15 22:36 ` [Bluez,v2] " bluez.test.bot
-- strict thread matches above, loose matches on Subject: below --
2021-03-12 11:59 [PATCH Bluez v2] "
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.