summaryrefslogtreecommitdiff
path: root/src/devices/wwan/nm-device-modem.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-06-27 16:21:43 +0200
committerThomas Haller <thaller@redhat.com>2018-07-24 09:39:09 +0200
commit570e1fa75b3369eb324afceb32d15f2ba2051df7 (patch)
tree1d23963e26f762aa8c869ef332bef39b2066ae9c /src/devices/wwan/nm-device-modem.c
parent246b74754048e90ab2bd7e6ad9258b6948c47b82 (diff)
downloadNetworkManager-570e1fa75b3369eb324afceb32d15f2ba2051df7.tar.gz
core: give better error reason why device is unavailable
The error reason is still unused.
Diffstat (limited to 'src/devices/wwan/nm-device-modem.c')
-rw-r--r--src/devices/wwan/nm-device-modem.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
index 352b1c3e8b..57c4853936 100644
--- a/src/devices/wwan/nm-device-modem.c
+++ b/src/devices/wwan/nm-device-modem.c
@@ -409,22 +409,38 @@ static gboolean
check_connection_available (NMDevice *device,
NMConnection *connection,
NMDeviceCheckConAvailableFlags flags,
- const char *specific_object)
+ const char *specific_object,
+ GError **error)
{
NMDeviceModem *self = NM_DEVICE_MODEM (device);
NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (self);
NMModemState state;
- if (!priv->rf_enabled || !priv->modem)
+ if (!priv->rf_enabled) {
+ nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
+ "RFKILL for modem enabled");
return FALSE;
+ }
+
+ if (!priv->modem) {
+ nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
+ "modem not available");
+ return FALSE;
+ }
state = nm_modem_get_state (priv->modem);
- if (state <= NM_MODEM_STATE_INITIALIZING)
+ if (state <= NM_MODEM_STATE_INITIALIZING) {
+ nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
+ "modem not initalized");
return FALSE;
+ }
if (state == NM_MODEM_STATE_LOCKED) {
- if (!nm_connection_get_setting_gsm (connection))
+ if (!nm_connection_get_setting_gsm (connection)) {
+ nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
+ "modem is locked without pin available");
return FALSE;
+ }
}
return TRUE;