Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/7] lib: Add macros for advertising instance flags
@ 2015-03-25  3:05 Arman Uguray
  2015-03-25  3:05 ` [PATCH 2/7] tools/btmgmt: Add --connectable option to add-adv Arman Uguray
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Arman Uguray @ 2015-03-25  3:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Arman Uguray

This patch adds macro definitions for possible advertising instance
flags that can be passed to the "Add Advertising" mgmt command.
---
 lib/mgmt.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/mgmt.h b/lib/mgmt.h
index 01d948b..eb13c42 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -498,6 +498,14 @@ struct mgmt_rp_add_advertising {
 	uint8_t instance;
 } __packed;
 
+#define MGMT_ADV_FLAG_CONNECTABLE	(1 << 0)
+#define MGMT_ADV_FLAG_DISCOV		(1 << 1)
+#define MGMT_ADV_FLAG_LIMITED_DISCOV	(1 << 2)
+#define MGMT_ADV_FLAG_MANAGED_FLAGS	(1 << 3)
+#define MGMT_ADV_FLAG_TX_POWER		(1 << 4)
+#define MGMT_ADV_FLAG_APPEARANCE	(1 << 5)
+#define MGMT_ADV_FLAG_LOCAL_NAME	(1 << 6)
+
 #define MGMT_OP_REMOVE_ADVERTISING	0x003F
 struct mgmt_cp_remove_advertising {
 	uint8_t instance;
-- 
2.2.0.rc0.207.ga3a616c


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

* [PATCH 2/7] tools/btmgmt: Add --connectable option to add-adv
  2015-03-25  3:05 [PATCH 1/7] lib: Add macros for advertising instance flags Arman Uguray
@ 2015-03-25  3:05 ` Arman Uguray
  2015-03-25  3:05 ` [PATCH 3/7] tools/btmgmt: Add --discoverable " Arman Uguray
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Arman Uguray @ 2015-03-25  3:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Arman Uguray

This patch adds the --connectable (-c) option to the add-adv command,
which can be used to add connectable advertising instances.
---
 tools/btmgmt.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index a769fc3..4d68647 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -3687,16 +3687,17 @@ static void add_adv_rsp(uint8_t status, uint16_t len, const void *param,
 
 static void add_adv_usage(void)
 {
-	print("Usage: add-adv [-d adv_data] [-s scan_rsp] "
-						"[-t timeout] <instance_id>");
+	print("Usage: add-adv [-u uuid] [-d adv_data] [-s scan_rsp] "
+					"[-t timeout] [-c] <instance_id>");
 }
 
 static struct option add_adv_options[] = {
-	{ "help",	0, 0, 'h' },
-	{ "uuid",	1, 0, 'u' },
-	{ "adv-data",	1, 0, 'd' },
-	{ "scan-rsp",	1, 0, 's' },
-	{ "timeout",	1, 0, 't' },
+	{ "help",		0, 0, 'h' },
+	{ "uuid",		1, 0, 'u' },
+	{ "adv-data",		1, 0, 'd' },
+	{ "scan-rsp",		1, 0, 's' },
+	{ "timeout",		1, 0, 't' },
+	{ "connectable",	0, 0, 'c' },
 	{ 0, 0, 0, 0}
 };
 
@@ -3758,8 +3759,9 @@ static void cmd_add_adv(struct mgmt *mgmt, uint16_t index,
 	uuid_t uuid;
 	bool success = false;
 	bool quit = true;
+	uint32_t flags = 0;
 
-	while ((opt = getopt_long(argc, argv, "+u:d:s:t:h",
+	while ((opt = getopt_long(argc, argv, "+u:d:s:t:ch",
 						add_adv_options, NULL)) != -1) {
 		switch (opt) {
 		case 'u':
@@ -3820,6 +3822,9 @@ static void cmd_add_adv(struct mgmt *mgmt, uint16_t index,
 		case 't':
 			timeout = strtol(optarg, NULL, 0);
 			break;
+		case 'c':
+			flags |= MGMT_ADV_FLAG_CONNECTABLE;
+			break;
 		case 'h':
 			success = true;
 		default:
@@ -3851,6 +3856,7 @@ static void cmd_add_adv(struct mgmt *mgmt, uint16_t index,
 		goto done;
 
 	cp->instance = instance;
+	put_le32(flags, &cp->flags);
 	put_le16(timeout, &cp->timeout);
 	cp->adv_data_len = adv_len + uuid_bytes;
 	cp->scan_rsp_len = scan_rsp_len;
-- 
2.2.0.rc0.207.ga3a616c


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

* [PATCH 3/7] tools/btmgmt: Add --discoverable option to add-adv
  2015-03-25  3:05 [PATCH 1/7] lib: Add macros for advertising instance flags Arman Uguray
  2015-03-25  3:05 ` [PATCH 2/7] tools/btmgmt: Add --connectable option to add-adv Arman Uguray
@ 2015-03-25  3:05 ` Arman Uguray
  2015-03-25  3:05 ` [PATCH 4/7] tools/btmgmt: Add --limited-discov " Arman Uguray
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Arman Uguray @ 2015-03-25  3:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Arman Uguray

This patch adds the --discoverable (-e) option to the add-adv command,
which can be used to add "general discoverable" advertising instances.
---
 tools/btmgmt.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 4d68647..72768c3 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -3688,7 +3688,7 @@ static void add_adv_rsp(uint8_t status, uint16_t len, const void *param,
 static void add_adv_usage(void)
 {
 	print("Usage: add-adv [-u uuid] [-d adv_data] [-s scan_rsp] "
-					"[-t timeout] [-c] <instance_id>");
+				"[-t timeout] [-c] [-d] [-e] <instance_id>");
 }
 
 static struct option add_adv_options[] = {
@@ -3698,6 +3698,7 @@ static struct option add_adv_options[] = {
 	{ "scan-rsp",		1, 0, 's' },
 	{ "timeout",		1, 0, 't' },
 	{ "connectable",	0, 0, 'c' },
+	{ "discoverable",	0, 0, 'e' },
 	{ 0, 0, 0, 0}
 };
 
@@ -3761,7 +3762,7 @@ static void cmd_add_adv(struct mgmt *mgmt, uint16_t index,
 	bool quit = true;
 	uint32_t flags = 0;
 
-	while ((opt = getopt_long(argc, argv, "+u:d:s:t:ch",
+	while ((opt = getopt_long(argc, argv, "+u:d:s:t:ceh",
 						add_adv_options, NULL)) != -1) {
 		switch (opt) {
 		case 'u':
@@ -3825,6 +3826,9 @@ static void cmd_add_adv(struct mgmt *mgmt, uint16_t index,
 		case 'c':
 			flags |= MGMT_ADV_FLAG_CONNECTABLE;
 			break;
+		case 'e':
+			flags |= MGMT_ADV_FLAG_DISCOV;
+			break;
 		case 'h':
 			success = true;
 		default:
-- 
2.2.0.rc0.207.ga3a616c


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

* [PATCH 4/7] tools/btmgmt: Add --limited-discov option to add-adv
  2015-03-25  3:05 [PATCH 1/7] lib: Add macros for advertising instance flags Arman Uguray
  2015-03-25  3:05 ` [PATCH 2/7] tools/btmgmt: Add --connectable option to add-adv Arman Uguray
  2015-03-25  3:05 ` [PATCH 3/7] tools/btmgmt: Add --discoverable " Arman Uguray
@ 2015-03-25  3:05 ` Arman Uguray
  2015-03-25  3:05 ` [PATCH 5/7] tools/btmgmt: Add --managed-flags " Arman Uguray
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Arman Uguray @ 2015-03-25  3:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Arman Uguray

This patch adds the --limited-discov (-l) option to the add-adv command,
which can be used to add "limited discoverable" advertising instances.
---
 tools/btmgmt.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 72768c3..a870b52 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -3688,7 +3688,7 @@ static void add_adv_rsp(uint8_t status, uint16_t len, const void *param,
 static void add_adv_usage(void)
 {
 	print("Usage: add-adv [-u uuid] [-d adv_data] [-s scan_rsp] "
-				"[-t timeout] [-c] [-d] [-e] <instance_id>");
+			"[-t timeout] [-c] [-d] [-e] [-l] <instance_id>");
 }
 
 static struct option add_adv_options[] = {
@@ -3699,6 +3699,7 @@ static struct option add_adv_options[] = {
 	{ "timeout",		1, 0, 't' },
 	{ "connectable",	0, 0, 'c' },
 	{ "discoverable",	0, 0, 'e' },
+	{ "limited-discov",	0, 0, 'l' },
 	{ 0, 0, 0, 0}
 };
 
@@ -3762,7 +3763,7 @@ static void cmd_add_adv(struct mgmt *mgmt, uint16_t index,
 	bool quit = true;
 	uint32_t flags = 0;
 
-	while ((opt = getopt_long(argc, argv, "+u:d:s:t:ceh",
+	while ((opt = getopt_long(argc, argv, "+u:d:s:t:celh",
 						add_adv_options, NULL)) != -1) {
 		switch (opt) {
 		case 'u':
@@ -3829,6 +3830,9 @@ static void cmd_add_adv(struct mgmt *mgmt, uint16_t index,
 		case 'e':
 			flags |= MGMT_ADV_FLAG_DISCOV;
 			break;
+		case 'l':
+			flags |= MGMT_ADV_FLAG_LIMITED_DISCOV;
+			break;
 		case 'h':
 			success = true;
 		default:
-- 
2.2.0.rc0.207.ga3a616c


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

* [PATCH 5/7] tools/btmgmt: Add --managed-flags option to add-adv
  2015-03-25  3:05 [PATCH 1/7] lib: Add macros for advertising instance flags Arman Uguray
                   ` (2 preceding siblings ...)
  2015-03-25  3:05 ` [PATCH 4/7] tools/btmgmt: Add --limited-discov " Arman Uguray
@ 2015-03-25  3:05 ` Arman Uguray
  2015-03-25  3:05 ` [PATCH 6/7] tools/btmgmt: Add --tx-power " Arman Uguray
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Arman Uguray @ 2015-03-25  3:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Arman Uguray

This patch adds the --managed-flags (-m) option to the add-adv command,
which can be used to request that the "Flags" AD field be managed by
the kernel for a given advertising instance.
---
 tools/btmgmt.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index a870b52..22a2c8c 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -3688,7 +3688,7 @@ static void add_adv_rsp(uint8_t status, uint16_t len, const void *param,
 static void add_adv_usage(void)
 {
 	print("Usage: add-adv [-u uuid] [-d adv_data] [-s scan_rsp] "
-			"[-t timeout] [-c] [-d] [-e] [-l] <instance_id>");
+			"[-t timeout] [-c] [-d] [-e] [-l] [-m] <instance_id>");
 }
 
 static struct option add_adv_options[] = {
@@ -3700,6 +3700,7 @@ static struct option add_adv_options[] = {
 	{ "connectable",	0, 0, 'c' },
 	{ "discoverable",	0, 0, 'e' },
 	{ "limited-discov",	0, 0, 'l' },
+	{ "managed-flags",	0, 0, 'm' },
 	{ 0, 0, 0, 0}
 };
 
@@ -3763,7 +3764,7 @@ static void cmd_add_adv(struct mgmt *mgmt, uint16_t index,
 	bool quit = true;
 	uint32_t flags = 0;
 
-	while ((opt = getopt_long(argc, argv, "+u:d:s:t:celh",
+	while ((opt = getopt_long(argc, argv, "+u:d:s:t:celmh",
 						add_adv_options, NULL)) != -1) {
 		switch (opt) {
 		case 'u':
@@ -3833,6 +3834,9 @@ static void cmd_add_adv(struct mgmt *mgmt, uint16_t index,
 		case 'l':
 			flags |= MGMT_ADV_FLAG_LIMITED_DISCOV;
 			break;
+		case 'm':
+			flags |= MGMT_ADV_FLAG_MANAGED_FLAGS;
+			break;
 		case 'h':
 			success = true;
 		default:
-- 
2.2.0.rc0.207.ga3a616c


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

* [PATCH 6/7] tools/btmgmt: Add --tx-power option to add-adv
  2015-03-25  3:05 [PATCH 1/7] lib: Add macros for advertising instance flags Arman Uguray
                   ` (3 preceding siblings ...)
  2015-03-25  3:05 ` [PATCH 5/7] tools/btmgmt: Add --managed-flags " Arman Uguray
@ 2015-03-25  3:05 ` Arman Uguray
  2015-03-25  3:05 ` [PATCH 7/7] tools/btmgmt: Add the 'clr-adv' command Arman Uguray
  2015-03-26  2:29 ` [PATCH 1/7] lib: Add macros for advertising instance flags Johan Hedberg
  6 siblings, 0 replies; 8+ messages in thread
From: Arman Uguray @ 2015-03-25  3:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Arman Uguray

This patch adds the --tx-power (-p) option to the add-adv command,
which can be used to request that the "Tx Power" AD field be managed
by the kernel for a given advertising instance.
---
 tools/btmgmt.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 22a2c8c..54dd0f2 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -3688,7 +3688,7 @@ static void add_adv_rsp(uint8_t status, uint16_t len, const void *param,
 static void add_adv_usage(void)
 {
 	print("Usage: add-adv [-u uuid] [-d adv_data] [-s scan_rsp] "
-			"[-t timeout] [-c] [-d] [-e] [-l] [-m] <instance_id>");
+		"[-t timeout] [-c] [-d] [-e] [-l] [-m] [-p] <instance_id>");
 }
 
 static struct option add_adv_options[] = {
@@ -3701,6 +3701,7 @@ static struct option add_adv_options[] = {
 	{ "discoverable",	0, 0, 'e' },
 	{ "limited-discov",	0, 0, 'l' },
 	{ "managed-flags",	0, 0, 'm' },
+	{ "tx-power",		0, 0, 'p' },
 	{ 0, 0, 0, 0}
 };
 
@@ -3764,7 +3765,7 @@ static void cmd_add_adv(struct mgmt *mgmt, uint16_t index,
 	bool quit = true;
 	uint32_t flags = 0;
 
-	while ((opt = getopt_long(argc, argv, "+u:d:s:t:celmh",
+	while ((opt = getopt_long(argc, argv, "+u:d:s:t:celmph",
 						add_adv_options, NULL)) != -1) {
 		switch (opt) {
 		case 'u':
@@ -3837,6 +3838,9 @@ static void cmd_add_adv(struct mgmt *mgmt, uint16_t index,
 		case 'm':
 			flags |= MGMT_ADV_FLAG_MANAGED_FLAGS;
 			break;
+		case 'p':
+			flags |= MGMT_ADV_FLAG_TX_POWER;
+			break;
 		case 'h':
 			success = true;
 		default:
-- 
2.2.0.rc0.207.ga3a616c


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

* [PATCH 7/7] tools/btmgmt: Add the 'clr-adv' command
  2015-03-25  3:05 [PATCH 1/7] lib: Add macros for advertising instance flags Arman Uguray
                   ` (4 preceding siblings ...)
  2015-03-25  3:05 ` [PATCH 6/7] tools/btmgmt: Add --tx-power " Arman Uguray
@ 2015-03-25  3:05 ` Arman Uguray
  2015-03-26  2:29 ` [PATCH 1/7] lib: Add macros for advertising instance flags Johan Hedberg
  6 siblings, 0 replies; 8+ messages in thread
From: Arman Uguray @ 2015-03-25  3:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Arman Uguray

This patch introduces the 'clr-adv' command which allows users to remove
all registered advertising instances.
---
 tools/btmgmt.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 54dd0f2..f64327b 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -3955,6 +3955,14 @@ static void cmd_rm_adv(struct mgmt *mgmt, uint16_t index, int argc, char **argv)
 	}
 }
 
+static void cmd_clr_adv(struct mgmt *mgmt, uint16_t index, int argc, char **argv)
+{
+	char *all_instances = "0";
+	char *rm_argv[] = { "rm-adv", all_instances, NULL };
+
+	cmd_rm_adv(mgmt, index, 2, rm_argv);
+}
+
 struct cmd_info {
 	char *cmd;
 	void (*func)(struct mgmt *mgmt, uint16_t index, int argc, char **argv);
@@ -4018,8 +4026,9 @@ static struct cmd_info all_cmd[] = {
 	{ "bredr-oob",	cmd_bredr_oob,	"Local OOB data (BR/EDR)"	},
 	{ "le-oob",	cmd_le_oob,	"Local OOB data (LE)"		},
 	{ "advinfo",	cmd_advinfo,	"Show advertising features"	},
-	{ "add-adv",	cmd_add_adv,	"Add Advertising Data"		},
-	{ "rm-adv",	cmd_rm_adv,	"Remove Advertising Data"	},
+	{ "add-adv",	cmd_add_adv,	"Add advertising instance"	},
+	{ "rm-adv",	cmd_rm_adv,	"Remove advertising instance"	},
+	{ "clr-adv",	cmd_clr_adv,	"Clear advertising instances"	},
 };
 
 static void cmd_quit(struct mgmt *mgmt, uint16_t index,
-- 
2.2.0.rc0.207.ga3a616c


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

* Re: [PATCH 1/7] lib: Add macros for advertising instance flags
  2015-03-25  3:05 [PATCH 1/7] lib: Add macros for advertising instance flags Arman Uguray
                   ` (5 preceding siblings ...)
  2015-03-25  3:05 ` [PATCH 7/7] tools/btmgmt: Add the 'clr-adv' command Arman Uguray
@ 2015-03-26  2:29 ` Johan Hedberg
  6 siblings, 0 replies; 8+ messages in thread
From: Johan Hedberg @ 2015-03-26  2:29 UTC (permalink / raw)
  To: Arman Uguray; +Cc: linux-bluetooth

Hi Arman,

On Tue, Mar 24, 2015, Arman Uguray wrote:
> This patch adds macro definitions for possible advertising instance
> flags that can be passed to the "Add Advertising" mgmt command.
> ---
>  lib/mgmt.h | 8 ++++++++
>  1 file changed, 8 insertions(+)

All seven patches have been applied. Thanks.

Johan

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

end of thread, other threads:[~2015-03-26  2:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-25  3:05 [PATCH 1/7] lib: Add macros for advertising instance flags Arman Uguray
2015-03-25  3:05 ` [PATCH 2/7] tools/btmgmt: Add --connectable option to add-adv Arman Uguray
2015-03-25  3:05 ` [PATCH 3/7] tools/btmgmt: Add --discoverable " Arman Uguray
2015-03-25  3:05 ` [PATCH 4/7] tools/btmgmt: Add --limited-discov " Arman Uguray
2015-03-25  3:05 ` [PATCH 5/7] tools/btmgmt: Add --managed-flags " Arman Uguray
2015-03-25  3:05 ` [PATCH 6/7] tools/btmgmt: Add --tx-power " Arman Uguray
2015-03-25  3:05 ` [PATCH 7/7] tools/btmgmt: Add the 'clr-adv' command Arman Uguray
2015-03-26  2:29 ` [PATCH 1/7] lib: Add macros for advertising instance flags Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox