Linux bluetooth development
 help / color / mirror / Atom feed
From: Francois Beaufort <beaufort.francois@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v2] Updated bluetoothctl command to remove all devices
Date: Fri, 22 Jan 2016 15:38:51 +0100	[thread overview]
Message-ID: <1453473531-10940-1-git-send-email-beaufort.francois@gmail.com> (raw)

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

diff --git a/client/main.c b/client/main.c
index b695744..1361e80 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1317,6 +1317,7 @@ static void remove_device_setup(DBusMessageIter *iter, void *user_data)
 static void cmd_remove(const char *arg)
 {
 	GDBusProxy *proxy;
+	GList *list;
 	char *path;
 
 	if (!arg || !strlen(arg)) {
@@ -1327,6 +1328,14 @@ static void cmd_remove(const char *arg)
 	if (check_default_ctrl() == FALSE)
 		return;
 
+	if (strcmp(arg, "*") == 0) {
+		for (list = g_list_first(dev_list); list; list = g_list_next(list)) {
+			GDBusProxy *proxy = list->data;
+			cmd_remove(g_dbus_proxy_get_path(proxy));
+		}
+		return;
+	}
+
 	proxy = find_proxy_by_address(dev_list, arg);
 	if (!proxy) {
 		rl_printf("Device %s not available\n", arg);
-- 
2.7.0


             reply	other threads:[~2016-01-22 14:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22 14:38 Francois Beaufort [this message]
2016-01-23 12:03 ` [PATCH v2] Updated bluetoothctl command to remove all devices 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=1453473531-10940-1-git-send-email-beaufort.francois@gmail.com \
    --to=beaufort.francois@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