[PATCH] client: Display address if calling 'disconnect' without arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux