Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/3] client: Always start an agent
Date: Sun, 23 Apr 2017 23:14:57 +0300	[thread overview]
Message-ID: <20170423201457.7963-3-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20170423201457.7963-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Always register agent with default capability.
---
 client/main.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/client/main.c b/client/main.c
index 8c9d5c3..255cbd5 100644
--- a/client/main.c
+++ b/client/main.c
@@ -2355,10 +2355,10 @@ static gboolean option_version = FALSE;
 static gboolean parse_agent(const char *key, const char *value,
 					gpointer user_data, GError **error)
 {
-	if (value)
-		auto_register_agent = g_strdup(value);
-	else
-		auto_register_agent = g_strdup("");
+	if (!value)
+		return FALSE;
+
+	auto_register_agent = g_strdup(value);
 
 	return TRUE;
 }
@@ -2366,8 +2366,7 @@ static gboolean parse_agent(const char *key, const char *value,
 static GOptionEntry options[] = {
 	{ "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
 				"Show version information and exit" },
-	{ "agent", 'a', G_OPTION_FLAG_OPTIONAL_ARG,
-				G_OPTION_ARG_CALLBACK, parse_agent,
+	{ "agent", 'a', 0, G_OPTION_ARG_CALLBACK, parse_agent,
 				"Register agent handler", "CAPABILITY" },
 	{ NULL },
 };
@@ -2385,6 +2384,8 @@ int main(int argc, char *argv[])
 	GDBusClient *client;
 	guint signal;
 
+	auto_register_agent = g_strdup("");
+
 	context = g_option_context_new(NULL);
 	g_option_context_add_main_entries(context, options, NULL);
 
-- 
2.9.3


  parent reply	other threads:[~2017-04-23 20:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-23 20:14 [PATCH BlueZ 1/3] monitor: Add frame counter support Luiz Augusto von Dentz
2017-04-23 20:14 ` [PATCH BlueZ 2/3] monitor: Fix not decoding control frames Luiz Augusto von Dentz
2017-04-23 20:14 ` Luiz Augusto von Dentz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-04-20 12:32 [PATCH BlueZ 1/3] monitor: Add frame number support Luiz Augusto von Dentz
2017-04-20 12:32 ` [PATCH BlueZ 3/3] client: Always start an agent Luiz Augusto von Dentz
2017-04-20 12:52   ` Marcel Holtmann
2017-04-20 13:13     ` Luiz Augusto von Dentz

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=20170423201457.7963-3-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --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