[PATCH 7/9] Modify NMDeviceModem's available logic



This patch modifies NMDeviceModem's available logic such that
the device is only considered available if the modem_state is
= NM_MODEM_STATE_REGISTERED.  NMDevice defines 'available' as
meaning the device is in such a state that it can be activated.
This change prevents NM from trying to activate a modem which
is not yet ready to be activated.

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1445080

Gbp-Pq: Name Modify-NMDeviceModem-s-available-logic.patch
---
 src/devices/wwan/nm-device-modem.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
index 39a34db..3bbd170 100644
--- a/src/devices/wwan/nm-device-modem.c
+++ b/src/devices/wwan/nm-device-modem.c
@@ -410,14 +410,15 @@ check_connection_available (NMDevice *device,
                return FALSE;
 
        state = nm_modem_get_state (priv->modem);
-       if (state <= NM_MODEM_STATE_INITIALIZING)
-               return FALSE;
 
        if (state == NM_MODEM_STATE_LOCKED) {
                if (!nm_connection_get_setting_gsm (connection))
                        return FALSE;
        }
 
+       if (state <= NM_MODEM_STATE_SEARCHING)
+               return FALSE;
+
        return TRUE;
 }
 
@@ -598,7 +599,7 @@ is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
 
        g_assert (priv->modem);
        modem_state = nm_modem_get_state (priv->modem);
-       if (modem_state <= NM_MODEM_STATE_INITIALIZING)
+       if (modem_state <= NM_MODEM_STATE_SEARCHING)
                return FALSE;
 
        return TRUE;
-- 
2.7.4



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