Linux bluetooth development
 help / color / mirror / Atom feed
From: Arman Uguray <armansito@chromium.org>
To: linux-bluetooth@vger.kernel.org
Cc: Arman Uguray <armansito@chromium.org>
Subject: [PATCH 2/7] tools/btmgmt: Add --connectable option to add-adv
Date: Tue, 24 Mar 2015 20:05:49 -0700	[thread overview]
Message-ID: <1427252754-27889-2-git-send-email-armansito@chromium.org> (raw)
In-Reply-To: <1427252754-27889-1-git-send-email-armansito@chromium.org>

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


  reply	other threads:[~2015-03-25  3:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25  3:05 [PATCH 1/7] lib: Add macros for advertising instance flags Arman Uguray
2015-03-25  3:05 ` Arman Uguray [this message]
2015-03-25  3:05 ` [PATCH 3/7] tools/btmgmt: Add --discoverable option to add-adv 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

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=1427252754-27889-2-git-send-email-armansito@chromium.org \
    --to=armansito@chromium.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