All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] tools/hcitool: Fix help message for lecup
@ 2015-01-12 16:19 Szymon Janc
  2015-01-12 16:19 ` [PATCH 2/4] tools/hcitool: Fix support for simple lecup format Szymon Janc
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Szymon Janc @ 2015-01-12 16:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

Command options don't support short options and long options require
equal mark.
---
 tools/hcitool.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/hcitool.c b/tools/hcitool.c
index 0bd416f..cbd32f3 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -3296,11 +3296,11 @@ static const char *lecup_help =
 	"Usage:\n"
 	"\tlecup <handle> <min> <max> <latency> <timeout>\n"
 	"\tOptions:\n"
-	"\t    -H, --handle <0xXXXX>  LE connection handle\n"
-	"\t    -m, --min <interval>   Range: 0x0006 to 0x0C80\n"
-	"\t    -M, --max <interval>   Range: 0x0006 to 0x0C80\n"
-	"\t    -l, --latency <range>  Slave latency. Range: 0x0000 to 0x03E8\n"
-	"\t    -t, --timeout  <time>  N * 10ms. Range: 0x000A to 0x0C80\n"
+	"\t    --handle=<0xXXXX>  LE connection handle\n"
+	"\t    --min=<interval>   Range: 0x0006 to 0x0C80\n"
+	"\t    --max=<interval>   Range: 0x0006 to 0x0C80\n"
+	"\t    --latency=<range>  Slave latency. Range: 0x0000 to 0x03E8\n"
+	"\t    --timeout=<time>   N * 10ms. Range: 0x000A to 0x0C80\n"
 	"\n\t min/max range: 7.5ms to 4s. Multiply factor: 1.25ms"
 	"\n\t timeout range: 100ms to 32.0s. Larger than max interval\n";
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] tools/hcitool: Fix support for simple lecup format
  2015-01-12 16:19 [PATCH 1/4] tools/hcitool: Fix help message for lecup Szymon Janc
@ 2015-01-12 16:19 ` Szymon Janc
  2015-01-12 16:19 ` [PATCH 3/4] tools/hcitool: Simplify parsing in cmd_lecup Szymon Janc
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Szymon Janc @ 2015-01-12 16:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This allow to call lecup in simple form:
"hcitool lecup <handle> <min> <max> <latency> <timeout>".
---
 tools/hcitool.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/hcitool.c b/tools/hcitool.c
index cbd32f3..612e5bc 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -3308,6 +3308,7 @@ static void cmd_lecup(int dev_id, int argc, char **argv)
 {
 	uint16_t handle = 0, min, max, latency, timeout;
 	int opt, dd, base;
+	int options = 0;
 
 	/* Aleatory valid values */
 	min = 0x0C8;
@@ -3341,6 +3342,18 @@ static void cmd_lecup(int dev_id, int argc, char **argv)
 			printf("%s", lecup_help);
 			return;
 		}
+
+		options = 1;
+	}
+
+	if (options == 0) {
+		helper_arg(5, 5, &argc, &argv, lecup_help);
+
+		handle = strtoul(argv[0], NULL, 0);
+		min = strtoul(argv[1], NULL, 0);
+		max = strtoul(argv[2], NULL, 0);
+		latency = strtoul(argv[3], NULL, 0);
+		timeout = strtoul(argv[4], NULL, 0);
 	}
 
 	if (handle == 0) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] tools/hcitool: Simplify parsing in cmd_lecup
  2015-01-12 16:19 [PATCH 1/4] tools/hcitool: Fix help message for lecup Szymon Janc
  2015-01-12 16:19 ` [PATCH 2/4] tools/hcitool: Fix support for simple lecup format Szymon Janc
@ 2015-01-12 16:19 ` Szymon Janc
  2015-01-12 16:19 ` [PATCH 4/4] tools/hcitool: Update manual page Szymon Janc
  2015-01-14 11:06 ` [PATCH 1/4] tools/hcitool: Fix help message for lecup Johan Hedberg
  3 siblings, 0 replies; 5+ messages in thread
From: Szymon Janc @ 2015-01-12 16:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

strtoul already detects 10 or 16 base if given base is 0.
---
 tools/hcitool.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/tools/hcitool.c b/tools/hcitool.c
index 612e5bc..a37e028 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -3307,7 +3307,7 @@ static const char *lecup_help =
 static void cmd_lecup(int dev_id, int argc, char **argv)
 {
 	uint16_t handle = 0, min, max, latency, timeout;
-	int opt, dd, base;
+	int opt, dd;
 	int options = 0;
 
 	/* Aleatory valid values */
@@ -3317,26 +3317,21 @@ static void cmd_lecup(int dev_id, int argc, char **argv)
 	timeout = 0x0C80;
 
 	for_each_opt(opt, lecup_options, NULL) {
-		if (optarg && strncasecmp("0x", optarg, 2) == 0)
-			base = 16;
-		else
-			base = 10;
-
 		switch (opt) {
 		case 'H':
-			handle = strtoul(optarg, NULL, base);
+			handle = strtoul(optarg, NULL, 0);
 			break;
 		case 'm':
-			min = strtoul(optarg, NULL, base);
+			min = strtoul(optarg, NULL, 0);
 			break;
 		case 'M':
-			max = strtoul(optarg, NULL, base);
+			max = strtoul(optarg, NULL, 0);
 			break;
 		case 'l':
-			latency = strtoul(optarg, NULL, base);
+			latency = strtoul(optarg, NULL, 0);
 			break;
 		case 't':
-			timeout = strtoul(optarg, NULL, base);
+			timeout = strtoul(optarg, NULL, 0);
 			break;
 		default:
 			printf("%s", lecup_help);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] tools/hcitool: Update manual page
  2015-01-12 16:19 [PATCH 1/4] tools/hcitool: Fix help message for lecup Szymon Janc
  2015-01-12 16:19 ` [PATCH 2/4] tools/hcitool: Fix support for simple lecup format Szymon Janc
  2015-01-12 16:19 ` [PATCH 3/4] tools/hcitool: Simplify parsing in cmd_lecup Szymon Janc
@ 2015-01-12 16:19 ` Szymon Janc
  2015-01-14 11:06 ` [PATCH 1/4] tools/hcitool: Fix help message for lecup Johan Hedberg
  3 siblings, 0 replies; 5+ messages in thread
From: Szymon Janc @ 2015-01-12 16:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This updates hcitool manual with new options.
---

Should be enhanced with options description but it is still better
than nothing :)

 tools/hcitool.1 | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/tools/hcitool.1 b/tools/hcitool.1
index 85498dc..7d06556 100644
--- a/tools/hcitool.1
+++ b/tools/hcitool.1
@@ -203,6 +203,52 @@ The clock can be
 for the local clock or
 .BR 1
 for the piconet clock (which is default).
+.TP
+.BI lescan " [--privacy] [--passive] [--whitelist] [--discovery=g|l] \
+[--duplicates]"
+Start LE scan
+.TP
+.BI leinfo " [--static] [--random] <bdaddr>"
+Get LE remote information
+.TP
+.BI lewladd " [--random] <bdaddr>"
+Add device to LE White List
+.TP
+.BI lewlrm " <bdaddr>"
+Remove device from LE White List
+.TP
+.BI lewlsz
+Read size of LE White List
+.TP
+.BI lewlclr
+Clear LE White List
+.TP
+.BI lerladd " [--local irk] [--peer irk] [--random] <bdaddr>"
+Add device to LE Resolving List
+.TP
+.BI lerlrm " <bdaddr>"
+Remove device from LE Resolving List
+.TP
+.BI lerlclr
+Clear LE Resolving List
+.TP
+.BI lerlsz
+Read size of LE Resolving List
+.TP
+.BI lerlon
+Enable LE Address Resolution
+.TP
+.BI lerloff
+Disable LE Address Resolution
+.TP
+.BI lecc " [--static] [--random] <bdaddr> | [--whitelist]"
+Create a LE Connection
+.TP
+.BI ledc " <handle> [reason]"
+Disconnect a LE Connection
+.TP
+.BI lecup " <handle> <min> <max> <latency> <timeout>"
+LE Connection Update
 .SH AUTHORS
 Written by Maxim Krasnyansky <maxk@qualcomm.com> and Marcel Holtmann <marcel@holtmann.org>
 .PP
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/4] tools/hcitool: Fix help message for lecup
  2015-01-12 16:19 [PATCH 1/4] tools/hcitool: Fix help message for lecup Szymon Janc
                   ` (2 preceding siblings ...)
  2015-01-12 16:19 ` [PATCH 4/4] tools/hcitool: Update manual page Szymon Janc
@ 2015-01-14 11:06 ` Johan Hedberg
  3 siblings, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2015-01-14 11:06 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth

Hi Szymon,

On Mon, Jan 12, 2015, Szymon Janc wrote:
> Command options don't support short options and long options require
> equal mark.
> ---
>  tools/hcitool.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

All four patches in this set have been applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-01-14 11:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-12 16:19 [PATCH 1/4] tools/hcitool: Fix help message for lecup Szymon Janc
2015-01-12 16:19 ` [PATCH 2/4] tools/hcitool: Fix support for simple lecup format Szymon Janc
2015-01-12 16:19 ` [PATCH 3/4] tools/hcitool: Simplify parsing in cmd_lecup Szymon Janc
2015-01-12 16:19 ` [PATCH 4/4] tools/hcitool: Update manual page Szymon Janc
2015-01-14 11:06 ` [PATCH 1/4] tools/hcitool: Fix help message for lecup Johan Hedberg

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.