From 12787f85656830be55296e96eb4553f3f301ab69 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sat, 8 Feb 2014 07:52:24 -0600 Subject: [PATCH] mobile: fix disconnection on deactivation When c4fc72c7 began using the DEACTIVATING state, the modem code wasn't updated to handle this. Because it only checked for activating or ACTIVATED states to determine whether the modem was previously connected, and thus when an MM disconnect was needed, when the device enters the DISCONNECTED state it was no longer considered previously active, and not disconnected. Also, remove the NEED_AUTH handling from the modem code's device state switch, because it does not appear to be needed. The modem will only enter NEED_AUTH when it requires PAP/CHAP secrets during the connection attempt or when a PIN is required before enabling the modem. In both cases the modem won't yet be connected, so this code will never be hit. --- src/modem-manager/nm-modem.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/modem-manager/nm-modem.c b/src/modem-manager/nm-modem.c index 998decaa4e..77ab710c7f 100644 --- a/src/modem-manager/nm-modem.c +++ b/src/modem-manager/nm-modem.c @@ -581,27 +581,21 @@ nm_modem_device_state_changed (NMModem *self, g_return_if_fail (NM_IS_MODEM (self)); - if (old_state >= NM_DEVICE_STATE_PREPARE && old_state <= NM_DEVICE_STATE_ACTIVATED) + if (old_state >= NM_DEVICE_STATE_PREPARE && old_state <= NM_DEVICE_STATE_DEACTIVATING) was_connected = TRUE; priv = NM_MODEM_GET_PRIVATE (self); /* Make sure we don't leave the serial device open */ switch (new_state) { - case NM_DEVICE_STATE_NEED_AUTH: - if (priv->ppp_manager) - break; - /* else fall through */ case NM_DEVICE_STATE_UNMANAGED: case NM_DEVICE_STATE_UNAVAILABLE: - case NM_DEVICE_STATE_FAILED: case NM_DEVICE_STATE_DISCONNECTED: - if (new_state != NM_DEVICE_STATE_NEED_AUTH) { - if (priv->act_request) { - cancel_get_secrets (self); - g_object_unref (priv->act_request); - priv->act_request = NULL; - } + case NM_DEVICE_STATE_FAILED: + if (priv->act_request) { + cancel_get_secrets (self); + g_object_unref (priv->act_request); + priv->act_request = NULL; } if (was_connected) {