From: Andre Guedes <andre.guedes@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Andre Guedes <andre.guedes@openbossa.org>
Subject: [PATCH] hcitool: fix interval and window parameters
Date: Thu, 24 Feb 2011 15:56:08 -0300 [thread overview]
Message-ID: <1298573768-26751-1-git-send-email-andre.guedes@openbossa.org> (raw)
Set interval and window parameters properly if --discovery option
is present in lescan command.
According to the Bluetooth spec, during a general or limited discovery
procedure the scan interval and the scan window should be set to
11.25 ms. If --discovery option isn't present, both parameters are set
to the default value (10 ms) defined in LE Set Scan Parameters Command.
According to that command description, the interval and window parameters
should be set as follows:
Time = N * 0.625 msec
So, in order to set the time values to 11.25 and 10 ms, the parameters
should be equal to 18 (0x0012) and 16 (0x0010), respectively.
---
tools/hcitool.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/hcitool.c b/tools/hcitool.c
index cb7d181..c5254ea 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -2429,6 +2429,8 @@ static void cmd_lescan(int dev_id, int argc, char **argv)
uint8_t own_type = 0x00;
uint8_t scan_type = 0x01;
uint8_t filter_type = 0;
+ uint16_t interval = htobs(0x0010);
+ uint16_t window = htobs(0x0010);
for_each_opt(opt, lescan_options, NULL) {
switch (opt) {
@@ -2444,6 +2446,9 @@ static void cmd_lescan(int dev_id, int argc, char **argv)
fprintf(stderr, "Unknown discovery procedure\n");
exit(1);
}
+
+ interval = htobs(0x0012);
+ window = htobs(0x0012);
break;
default:
printf("%s", lescan_help);
@@ -2461,8 +2466,8 @@ static void cmd_lescan(int dev_id, int argc, char **argv)
exit(1);
}
- err = hci_le_set_scan_parameters(dd, scan_type, htobs(0x0010),
- htobs(0x0010), own_type, 0x00);
+ err = hci_le_set_scan_parameters(dd, scan_type, interval, window,
+ own_type, 0x00);
if (err < 0) {
perror("Set scan parameters failed");
exit(1);
--
1.7.1
next reply other threads:[~2011-02-24 18:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-24 18:56 Andre Guedes [this message]
2011-02-24 20:41 ` [PATCH] hcitool: fix interval and window parameters Johan Hedberg
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=1298573768-26751-1-git-send-email-andre.guedes@openbossa.org \
--to=andre.guedes@openbossa.org \
--cc=linux-bluetooth@vger.kernel.org \
/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