From: Johan Hedberg <johan.hedberg@gmail.com>
To: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v2 05/10] emulator: Add handling inquiry_lenght from inquiry command
Date: Wed, 12 Mar 2014 13:44:50 +0200 [thread overview]
Message-ID: <20140312114450.GE7489@localhost.P-661HNU-F1> (raw)
In-Reply-To: <1394406363-6751-6-git-send-email-lukasz.rymanowski@tieto.com>
Hi Lukasz,
On Mon, Mar 10, 2014, Lukasz Rymanowski wrote:
> --- a/emulator/btdev.c
> +++ b/emulator/btdev.c
> @@ -70,6 +70,7 @@ struct btdev {
> void *send_data;
>
> int inquiry_id;
> + int inquiry_timeout_id;
> bool inquiry_cancel;
>
> struct hook *hook_list[MAX_HOOK_ENTRIES];
> @@ -133,6 +134,8 @@ struct inquiry_data {
>
> int sent_count;
> int iter;
> +
> + bool timeout;
> };
>
> #define DEFAULT_INQUIRY_INTERVAL 100 /* 100 miliseconds */
> @@ -711,6 +714,14 @@ static bool inquiry_callback(void *user_data)
> int sent = data->sent_count;
> int i;
>
> + /* Check if inquiry timeout fired. */
> + if (data->timeout)
> + goto finish;
> +
> + /*Report devices only once and wait for inquiry timeout*/
> + if (data->iter == MAX_BTDEV_ENTRIES)
> + return true;
> +
> for (i = data->iter; i < MAX_BTDEV_ENTRIES; i++, data->iter++) {
> /*Lets sent 10 inquiry results at once */
> if (sent + 10 == data->sent_count)
> @@ -771,14 +782,10 @@ static bool inquiry_callback(void *user_data)
> data->sent_count++;
> }
> }
> -
> /* Check if we sent already required amount of responses*/
> if (data->num_resp && data->sent_count == data->num_resp)
> goto finish;
>
> - if (i == MAX_BTDEV_ENTRIES)
> - goto finish;
> -
> return true;
>
> finish:
> @@ -806,16 +813,33 @@ static void inquiry_destroy(void *user_data)
> btdev->inquiry_cancel = false;
> btdev->inquiry_id = 0;
>
> + if (btdev->inquiry_timeout_id)
> + timeout_remove(btdev->inquiry_timeout_id);
> +
> + btdev->inquiry_timeout_id = 0;
> +
> finish:
> free(data);
> }
>
> +static bool inquiry_timeout(void *user_data)
> +{
> + struct inquiry_data *data = user_data;
> + struct btdev *btdev = data->btdev;
> +
> + data->timeout = true;
> + btdev->inquiry_timeout_id = 0;
> +
> + return false;
> +}
Instead of adding the new data->timeout variable why don't you simply
send the inquiry_complete from within the inquiry_timeout callback?
Johan
next prev parent reply other threads:[~2014-03-12 11:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-09 23:05 [PATCH v2 00/10] Change inquiry handling in btdev Lukasz Rymanowski
2014-03-09 23:05 ` [PATCH v2 01/10] emulator: Minor style fix Lukasz Rymanowski
2014-03-12 11:22 ` Johan Hedberg
2014-03-09 23:05 ` [PATCH v2 02/10] emulator: Use timeout for sending inquiry results Lukasz Rymanowski
2014-03-12 11:28 ` Johan Hedberg
2014-03-14 15:56 ` Lukasz Rymanowski
2014-03-09 23:05 ` [PATCH v2 03/10] emulator: Add inquiry cancel Lukasz Rymanowski
2014-03-12 11:39 ` Johan Hedberg
2014-03-14 15:57 ` Lukasz Rymanowski
2014-03-09 23:05 ` [PATCH v2 04/10] emulator: Add handling inquiry number of responses Lukasz Rymanowski
2014-03-12 11:42 ` Johan Hedberg
2014-03-14 15:57 ` Lukasz Rymanowski
2014-03-09 23:05 ` [PATCH v2 05/10] emulator: Add handling inquiry_lenght from inquiry command Lukasz Rymanowski
2014-03-12 11:44 ` Johan Hedberg [this message]
2014-03-14 15:57 ` Lukasz Rymanowski
2014-03-09 23:05 ` [PATCH v2 06/10] android/tester: Fix handling inquiry by android tester Lukasz Rymanowski
2014-03-09 23:06 ` [PATCH v2 07/10] tools/mgmt-tester: Fix for Stop discovery test Lukasz Rymanowski
2014-03-09 23:06 ` [PATCH v2 08/10] tools/mgmt-tester: Update Stop Discovery-BR/EDR (Inquiry) Success 1 Lukasz Rymanowski
2014-03-09 23:06 ` [PATCH v2 09/10] tools/mgmt-tester: Remove not used condition Lukasz Rymanowski
2014-03-09 23:06 ` [PATCH v2 10/10] tools/mgmt-tester: Refactor setup_start_discovery function Lukasz Rymanowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140312114450.GE7489@localhost.P-661HNU-F1 \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=lukasz.rymanowski@tieto.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox