All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] client: Display address if calling 'disconnect' without arguments
@ 2015-06-04 19:06 Mateusz Lemusisk
  2015-06-05 14:32 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 2+ messages in thread
From: Mateusz Lemusisk @ 2015-06-04 19:06 UTC (permalink / raw)
  To: linux-bluetooth

Before:

[PHILIPS BTM2180]# disconnect
Attempting to disconnect from
Successful disconnected

After:

[PHILIPS BTM2180]# disconnect
Attempting to disconnect from XX:XX:XX:XX:XX:XX
Successful disconnected

---
 client/main.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/client/main.c b/client/main.c
index 41e95b2..88ae5ed 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1422,7 +1422,19 @@ static void cmd_disconn(const char *arg)
 		return;
 	}
 
-	rl_printf("Attempting to disconnect from %s\n", arg);
+	if (strlen(arg) == 0) {
+		const char *default_address;
+		DBusMessageIter iter;
+
+		if (g_dbus_proxy_get_property(proxy, "Address", &iter) == FALSE)
+			default_address = "";
+		else
+			dbus_message_iter_get_basic(&iter, &default_address);
+
+		rl_printf("Attempting to disconnect from %s\n", default_address);
+	} else {
+		rl_printf("Attempting to disconnect from %s\n", arg);
+	}
 }
 
 static void cmd_list_attributes(const char *arg)
-- 
2.4.2


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

end of thread, other threads:[~2015-06-05 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-04 19:06 [PATCH] client: Display address if calling 'disconnect' without arguments Mateusz Lemusisk
2015-06-05 14:32 ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.