summaryrefslogtreecommitdiff
path: root/src/devices/wwan/nm-device-modem.c
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-03-01 17:43:37 +0100
committerLubomir Rintel <lkundrak@v3.sk>2019-03-12 16:02:04 +0100
commit2e8f43e379c61d79b6dd1b27ee1d9cb950447ad5 (patch)
tree4479681dcd7a102ce3f82f3cd9053c8cc0cea723 /src/devices/wwan/nm-device-modem.c
parent10276322bde8f015e48ac06f6a7509f514eb46f0 (diff)
downloadNetworkManager-2e8f43e379c61d79b6dd1b27ee1d9cb950447ad5.tar.gz
wwan/device-modem: don't enter available state until registered
Based on Ubuntu's "Modify NMDeviceModem's available logic" patch by Tony Espy <espy@canonical.com>. The original commit message: 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 https://github.com/NetworkManager/NetworkManager/pull/312
Diffstat (limited to 'src/devices/wwan/nm-device-modem.c')
-rw-r--r--src/devices/wwan/nm-device-modem.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
index 1e31628080..876f75d7e5 100644
--- a/src/devices/wwan/nm-device-modem.c
+++ b/src/devices/wwan/nm-device-modem.c
@@ -473,11 +473,6 @@ check_connection_available (NMDevice *device,
}
state = nm_modem_get_state (priv->modem);
- if (state <= NM_MODEM_STATE_INITIALIZING) {
- nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
- "modem not initialized");
- return FALSE;
- }
if (state == NM_MODEM_STATE_LOCKED) {
if (!nm_connection_get_setting_gsm (connection)) {
@@ -487,6 +482,12 @@ check_connection_available (NMDevice *device,
}
}
+ if (state < NM_MODEM_STATE_REGISTERED) {
+ nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
+ "modem not registered");
+ return FALSE;
+ }
+
return TRUE;
}
@@ -658,7 +659,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_REGISTERED)
return FALSE;
return TRUE;