aboutsummaryrefslogtreecommitdiff
path: root/src/mm-broadband-modem.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2022-05-20 14:41:48 +0200
committerAleksander Morgado <aleksander@aleksander.es>2022-05-20 15:36:43 +0200
commit4140758fdf5417d742d971a138d40833cdc18847 (patch)
tree326a77a959fe847274c5ebfca7eb31f207b97d15 /src/mm-broadband-modem.c
parent0c67d93eddd897eab7b8b4eee3fa244d83cde9ee (diff)
base-modem: if ABORTED during initialization, modem not exported
Commit b497de325 introduced a change by which some common errors (e.g. SIM missing) would be reported as MM_CORE_ERROR_ABORTED. This had the undesired effect of making the MMBaseModem object not flag as valid the modem, because the returned error wasn't MM_CORE_ERROR_WRONG_STATE. We now change this logic so that only ABORTED makes the modem object not flagged as valid, and we'll do that only if the Modem interface isn't exposed in DBus. Fixes b497de325
Diffstat (limited to 'src/mm-broadband-modem.c')
-rw-r--r--src/mm-broadband-modem.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 02fd0e2d..0cef006e 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -12665,28 +12665,19 @@ initialize_step (GTask *task)
if (ctx->self->priv->modem_state == MM_MODEM_STATE_FAILED) {
GError *error = NULL;
- if (ctx->self->priv->modem_dbus_skeleton) {
+ if (!ctx->self->priv->modem_dbus_skeleton) {
+ /* ABORTED here specifies an extremely fatal error that will make the modem
+ * not even exported in DBus */
+ error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_ABORTED,
+ "Fatal error: modem is unusable");
+ } else {
/* Fatal SIM, firmware, or modem failure :-( */
- gboolean is_sim_hot_swap_supported = FALSE;
MMModemStateFailedReason reason;
reason = mm_gdbus_modem_get_state_failed_reason (MM_GDBUS_MODEM (ctx->self->priv->modem_dbus_skeleton));
-
- g_object_get (ctx->self,
- MM_IFACE_MODEM_SIM_HOT_SWAP_SUPPORTED, &is_sim_hot_swap_supported,
- NULL);
-
- if (reason == MM_MODEM_STATE_FAILED_REASON_SIM_MISSING) {
- if (!is_sim_hot_swap_supported) {
- mm_obj_dbg (ctx->self, "SIM is missing, but this modem does not support SIM hot swap.");
- } else {
- mm_obj_dbg (ctx->self, "SIM is missing, but SIM hot swap is enabled; waiting for SIM...");
- error = g_error_new (MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Modem is unusable due to SIM missing, "
- "cannot fully initialize, waiting for SIM insertion.");
- }
- }
+ error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Modem in failed state: %s",
+ mm_modem_state_failed_reason_get_string (reason));
/* Ensure we only leave the Modem, Voice and Firmware interfaces
* around. A failure could be caused by firmware issues, which
@@ -12705,11 +12696,6 @@ initialize_step (GTask *task)
mm_iface_modem_simple_shutdown (MM_IFACE_MODEM_SIMPLE (ctx->self));
}
- if (!error)
- error = g_error_new (MM_CORE_ERROR,
- MM_CORE_ERROR_ABORTED,
- "Modem is unusable, cannot fully initialize");
-
g_task_return_error (task, error);
g_object_unref (task);
return;