Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Bastien Nocera <hadess@hadess.net>, Szymon Janc <szymon.janc@gmail.com>
Subject: [PATCH 6/7] client: Add block command
Date: Wed,  8 Jan 2014 01:02:27 +0100	[thread overview]
Message-ID: <1389139348-3552-7-git-send-email-szymon.janc@gmail.com> (raw)
In-Reply-To: <1389139348-3552-1-git-send-email-szymon.janc@gmail.com>

---
 client/main.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/client/main.c b/client/main.c
index a6e7906..9f9231a 100644
--- a/client/main.c
+++ b/client/main.c
@@ -880,6 +880,35 @@ static void cmd_untrust(const char *arg)
 	g_free(str);
 }
 
+static void cmd_block(const char *arg)
+{
+	GDBusProxy *proxy;
+	dbus_bool_t blocked;
+	char *str;
+
+	if (!arg || !strlen(arg)) {
+		rl_printf("Missing device address argument\n");
+		return;
+	}
+
+	proxy = find_proxy_by_address(dev_list, arg);
+	if (!proxy) {
+		rl_printf("Device %s not available\n", arg);
+		return;
+	}
+
+	blocked = TRUE;
+
+	str = g_strdup_printf("%s block", arg);
+
+	if (g_dbus_proxy_set_property_basic(proxy, "Blocked",
+					DBUS_TYPE_BOOLEAN, &blocked,
+					generic_callback, str, g_free) == TRUE)
+		return;
+
+	g_free(str);
+}
+
 static void remove_device_reply(DBusMessage *message, void *user_data)
 {
 	DBusError error;
@@ -1119,6 +1148,8 @@ static const struct {
 							dev_generator },
 	{ "untrust",      "<dev>",    cmd_untrust, "Untrust device",
 							dev_generator },
+	{ "block",        "<dev>",    cmd_block, "Block device",
+								dev_generator },
 	{ "remove",       "<dev>",    cmd_remove, "Remove device",
 							dev_generator },
 	{ "connect",      "<dev>",    cmd_connect, "Connect device",
-- 
1.8.5.2


  parent reply	other threads:[~2014-01-08  0:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08  0:02 [PATCH 0/7] sixaxis: Don't mark USB plugged device as trusted Szymon Janc
2014-01-08  0:02 ` [PATCH 1/7] " Szymon Janc
2014-01-08  0:02 ` [PATCH 2/7] input: Fix crash on authorization reply with first sixaxis connection Szymon Janc
2014-01-08  0:02 ` [PATCH 3/7] input: Fix check if device is sixaxis in auth_callback Szymon Janc
2014-01-08  0:02 ` [PATCH 4/7] input: Fix connecting new trusted sixaxis device Szymon Janc
2014-01-08  0:02 ` [PATCH 5/7] client: Add untrust command Szymon Janc
2014-01-08  0:02 ` Szymon Janc [this message]
2014-01-08  0:02 ` [PATCH 7/7] client: Add unblock command Szymon Janc
2014-01-09 15:57 ` [PATCH 0/7] sixaxis: Don't mark USB plugged device as trusted 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=1389139348-3552-7-git-send-email-szymon.janc@gmail.com \
    --to=szymon.janc@gmail.com \
    --cc=hadess@hadess.net \
    --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