about summary refs log tree commit diff
path: root/src/nm-device-bt.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2012-06-29 20:12:59 +0200
committerMichael Biebl <biebl@debian.org>2012-06-29 20:12:59 +0200
commitec7b2a4d322996da1e4b221f2f713652bf868d3b (patch)
tree88cd588a74c0de932f7cac871273b08b86fd759c /src/nm-device-bt.c
parent1376a21247cfd9d8bb1d4da7195112d03ff6e870 (diff)
parent867254ea7c2b193fecf8cd36cc6e5dc53c290d92 (diff)
Merge tag 'upstream/0.9.5.95' into experimental
Upstream version 0.9.5.95
Diffstat (limited to 'src/nm-device-bt.c')
-rw-r--r--src/nm-device-bt.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/nm-device-bt.c b/src/nm-device-bt.c
index 726762b6..f61aeb57 100644
--- a/src/nm-device-bt.c
+++ b/src/nm-device-bt.c
@@ -668,14 +668,18 @@ nm_device_bt_modem_removed (NMDeviceBt *self, NMModem *modem)
 	if (modem != priv->modem)
 		return FALSE;
 
+	/* Fail the device if the modem was removed while active */
 	state = nm_device_get_state (NM_DEVICE (self));
-	nm_modem_device_state_changed (priv->modem,
-	                               NM_DEVICE_STATE_DISCONNECTED,
-	                               state,
-	                               NM_DEVICE_STATE_REASON_USER_REQUESTED);
+	if (   state == NM_DEVICE_STATE_ACTIVATED
+	    || nm_device_is_activating (NM_DEVICE (self))) {
+		nm_device_state_changed (NM_DEVICE (self),
+		                         NM_DEVICE_STATE_FAILED,
+		                         NM_DEVICE_STATE_REASON_BT_FAILED);
+	} else {
+		g_object_unref (priv->modem);
+		priv->modem = NULL;
+	}
 
-	g_object_unref (priv->modem);
-	priv->modem = NULL;
 	return TRUE;
 }