* [PATCH] Bluetooth: hcitool: add option for LE_Scan_Type parameter
@ 2011-02-10 21:36 Emeltchenko Andrei
2011-02-11 11:09 ` Anderson Lizardo
2011-02-11 21:06 ` Johan Hedberg
0 siblings, 2 replies; 4+ messages in thread
From: Emeltchenko Andrei @ 2011-02-10 21:36 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
The LE_Scan_Type parameter controls the type of scan to perform.
---
tools/hcitool.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/tools/hcitool.c b/tools/hcitool.c
index c097526..6d17ad5 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -2350,23 +2350,33 @@ done:
static struct option lescan_options[] = {
{ "help", 0, 0, 'h' },
{ "privacy", 0, 0, 'p' },
+ { "scantype", 1, 0, 's' },
{ 0, 0, 0, 0 }
};
static const char *lescan_help =
"Usage:\n"
- "\tlescan [--privacy] enable privacy\n";
+ "\tlescan [--privacy] enable privacy\n"
+ "\tlescan [--scantype] set scan type 0 - passive, 1 - active (default)\n";
static void cmd_lescan(int dev_id, int argc, char **argv)
{
int err, opt, dd;
uint8_t own_type = 0x00;
+ uint8_t scan_type = 0x01;
for_each_opt(opt, lescan_options, NULL) {
switch (opt) {
case 'p':
own_type = 0x01; /* Random */
break;
+ case 's':
+ scan_type = atoi(optarg);
+ if (scan_type > 1) {
+ printf("%s", lescan_help);
+ exit(1);
+ }
+ break;
default:
printf("%s", lescan_help);
return;
@@ -2383,7 +2393,7 @@ static void cmd_lescan(int dev_id, int argc, char **argv)
exit(1);
}
- err = hci_le_set_scan_parameters(dd, 0x01, htobs(0x0010),
+ err = hci_le_set_scan_parameters(dd, scan_type, htobs(0x0010),
htobs(0x0010), own_type, 0x00);
if (err < 0) {
perror("Set scan parameters failed");
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] Bluetooth: hcitool: add option for LE_Scan_Type parameter
2011-02-10 21:36 [PATCH] Bluetooth: hcitool: add option for LE_Scan_Type parameter Emeltchenko Andrei
@ 2011-02-11 11:09 ` Anderson Lizardo
2011-02-11 21:06 ` Johan Hedberg
1 sibling, 0 replies; 4+ messages in thread
From: Anderson Lizardo @ 2011-02-11 11:09 UTC (permalink / raw)
To: Emeltchenko Andrei; +Cc: linux-bluetooth
Hi Andrei,
On Thu, Feb 10, 2011 at 6:36 PM, Emeltchenko Andrei
<Andrei.Emeltchenko.news@gmail.com> wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
>
> The LE_Scan_Type parameter controls the type of scan to perform.
> ---
> tools/hcitool.c | 14 ++++++++++++--
> 1 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/tools/hcitool.c b/tools/hcitool.c
> index c097526..6d17ad5 100644
> --- a/tools/hcitool.c
> +++ b/tools/hcitool.c
> @@ -2350,23 +2350,33 @@ done:
> static struct option lescan_options[] = {
> { "help", 0, 0, 'h' },
> { "privacy", 0, 0, 'p' },
> + { "scantype", 1, 0, 's' },
> { 0, 0, 0, 0 }
> };
>
> static const char *lescan_help =
> "Usage:\n"
> - "\tlescan [--privacy] enable privacy\n";
> + "\tlescan [--privacy] enable privacy\n"
> + "\tlescan [--scantype] set scan type 0 - passive, 1 - active (default)\n";
I think it is enough to have a "--passive" boolean option and set
scantype to 0x00 if it is TRUE and 0x01 if it is FALSE.
Regards,
--
Anderson Lizardo
OpenBossa Labs - INdT
Manaus - Brazil
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Bluetooth: hcitool: add option for LE_Scan_Type parameter
2011-02-10 21:36 [PATCH] Bluetooth: hcitool: add option for LE_Scan_Type parameter Emeltchenko Andrei
2011-02-11 11:09 ` Anderson Lizardo
@ 2011-02-11 21:06 ` Johan Hedberg
2011-02-11 21:10 ` Johan Hedberg
1 sibling, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2011-02-11 21:06 UTC (permalink / raw)
To: Emeltchenko Andrei; +Cc: linux-bluetooth
Hi Andrei,
On Thu, Feb 10, 2011, Emeltchenko Andrei wrote:
> + "\tlescan [--scantype] set scan type 0 - passive, 1 - active (default)\n";
Maybe this should be a boolean flag like the address type? I.e.
--passive and/or --active command line switches?
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Bluetooth: hcitool: add option for LE_Scan_Type parameter
2011-02-11 21:06 ` Johan Hedberg
@ 2011-02-11 21:10 ` Johan Hedberg
0 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2011-02-11 21:10 UTC (permalink / raw)
To: Emeltchenko Andrei, linux-bluetooth
Hi,
On Fri, Feb 11, 2011, Johan Hedberg wrote:
> Hi Andrei,
>
> On Thu, Feb 10, 2011, Emeltchenko Andrei wrote:
> > + "\tlescan [--scantype] set scan type 0 - passive, 1 - active (default)\n";
>
> Maybe this should be a boolean flag like the address type? I.e.
> --passive and/or --active command line switches?
Nevermind. I see that you already sent an updated patch which does this.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-11 21:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-10 21:36 [PATCH] Bluetooth: hcitool: add option for LE_Scan_Type parameter Emeltchenko Andrei
2011-02-11 11:09 ` Anderson Lizardo
2011-02-11 21:06 ` Johan Hedberg
2011-02-11 21:10 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox