summary refs log tree commit diff
path: root/cli/src/devices.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2010-11-29 19:00:22 +0100
committerMichael Biebl <biebl@debian.org>2010-11-29 19:00:22 +0100
commita6b89d35fabd9f5934b84d7cde22e9268f92c3d3 (patch)
tree9e44755880d5933fcc90c6008d4585a76298a1bd /cli/src/devices.c
parent9fae01fa351805b2903e535736e06971bc0b925e (diff)
Imported Upstream version 0.8.2 upstream/0.8.2
Diffstat (limited to 'cli/src/devices.c')
-rw-r--r--cli/src/devices.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/cli/src/devices.c b/cli/src/devices.c
index e2ce91e3..436b4b6e 100644
--- a/cli/src/devices.c
+++ b/cli/src/devices.c
@@ -58,12 +58,13 @@
 
 /* Available fields for 'dev status' */
 static NmcOutputField nmc_fields_dev_status[] = {
-	{"DEVICE",  N_("DEVICE"),    10, NULL, 0},  /* 0 */
-	{"TYPE",    N_("TYPE"),      17, NULL, 0},  /* 1 */
-	{"STATE",   N_("STATE"),     12, NULL, 0},  /* 2 */
-	{NULL,      NULL,             0, NULL, 0}
+	{"DEVICE",    N_("DEVICE"),      10, NULL, 0},  /* 0 */
+	{"TYPE",      N_("TYPE"),        17, NULL, 0},  /* 1 */
+	{"STATE",     N_("STATE"),       13, NULL, 0},  /* 2 */
+	{"DBUS-PATH", N_("DBUS-PATH"),   43, NULL, 0},  /* 3 */
+	{NULL,        NULL,               0, NULL, 0}
 };
-#define NMC_FIELDS_DEV_STATUS_ALL     "DEVICE,TYPE,STATE"
+#define NMC_FIELDS_DEV_STATUS_ALL     "DEVICE,TYPE,STATE,DBUS-PATH"
 #define NMC_FIELDS_DEV_STATUS_COMMON  "DEVICE,TYPE,STATE"
 
 
@@ -763,6 +764,7 @@ show_device_status (NMDevice *device, NmCli *nmc)
 	nmc->allowed_fields[0].value = nm_device_get_iface (device);
 	nmc->allowed_fields[1].value = get_device_type (device);
 	nmc->allowed_fields[2].value = device_state_to_string (nm_device_get_state (device));
+	nmc->allowed_fields[3].value = nm_object_get_path (NM_OBJECT (device));
 
 	nmc->print_fields.flags &= ~NMC_PF_FLAG_MAIN_HEADER_ADD & ~NMC_PF_FLAG_MAIN_HEADER_ONLY & ~NMC_PF_FLAG_FIELD_NAMES; /* Clear header flags */
 	print_fields (nmc->print_fields, nmc->allowed_fields);
@@ -929,7 +931,7 @@ disconnect_device_cb (NMDevice *device, GError *error, gpointer user_data)
 		state = nm_device_get_state (device);
 		printf (_("Device state: %d (%s)\n"), state, device_state_to_string (state));
 
-		if (!nmc->should_wait || state == NM_DEVICE_STATE_DISCONNECTED) {
+		if (nmc->nowait_flag || state == NM_DEVICE_STATE_DISCONNECTED) {
 			/* Don't want to wait or device already disconnected */
 			quit ();
 		} else {
@@ -1015,7 +1017,10 @@ do_device_disconnect (NmCli *nmc, int argc, char **argv)
 		goto error;
 	}
 
-	nmc->should_wait = wait;
+	/* Use nowait_flag instead of should_wait because exitting has to be postponed till disconnect_device_cb()
+	 * is called, giving NM time to check our permissions */
+	nmc->nowait_flag = !wait;
+	nmc->should_wait = TRUE;
 	nm_device_disconnect (device, disconnect_device_cb, nmc);
 
 error: