From 867254ea7c2b193fecf8cd36cc6e5dc53c290d92 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Fri, 29 Jun 2012 20:12:44 +0200 Subject: Imported Upstream version 0.9.5.95 --- src/nm-device-bt.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/nm-device-bt.c') 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; } -- cgit 1.3.0-6-gf8a5