aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-09-09 11:35:23 +0200
committerAleksander Morgado <aleksander@aleksander.es>2020-11-04 09:50:13 +0100
commiteb6ec1913f1403e7081f510d3e01e076fcfb9ddd (patch)
tree33c99d6e77298279f01ef727ca4434a3138202e4
parent7e70911074fbe281ebd27b673666287bac0f222e (diff)
cinterion: fallback to RF on on error right away
Don't go to next step and then check if we need to jump to the RF on step, jump right away.
-rw-r--r--plugins/cinterion/mm-broadband-modem-cinterion.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/plugins/cinterion/mm-broadband-modem-cinterion.c b/plugins/cinterion/mm-broadband-modem-cinterion.c
index 61f2f82b..17b1cb61 100644
--- a/plugins/cinterion/mm-broadband-modem-cinterion.c
+++ b/plugins/cinterion/mm-broadband-modem-cinterion.c
@@ -1011,13 +1011,13 @@ typedef struct {
SetInitialEpsStep step;
guint cid;
guint initial_cfun_mode;
- GError *error;
+ GError *saved_error;
} SetInitialEpsContext;
static void
set_initial_eps_context_free (SetInitialEpsContext *ctx)
{
- g_assert (!ctx->error);
+ g_assert (!ctx->saved_error);
g_object_unref (ctx->properties);
g_slice_free (SetInitialEpsContext, ctx);
}
@@ -1044,8 +1044,8 @@ set_initial_eps_rf_on_ready (MMBaseModem *self,
if (!mm_base_modem_at_command_finish (self, res, &error)) {
mm_obj_warn (self, "couldn't set RF back on: %s", error->message);
- if (!ctx->error)
- ctx->error = g_steal_pointer (&error);
+ if (!ctx->saved_error)
+ ctx->saved_error = g_steal_pointer (&error);
}
/* Go to next step */
@@ -1058,19 +1058,18 @@ set_initial_eps_auth_ready (MMBaseModem *self,
GAsyncResult *res,
GTask *task)
{
- g_autoptr(GError) error = NULL;
SetInitialEpsContext *ctx;
ctx = (SetInitialEpsContext *) g_task_get_task_data (task);
- if (!mm_base_modem_at_command_finish (self, res, &error)) {
- mm_obj_warn (self, "couldn't configure context %d auth settings: %s", ctx->cid, error->message);
- if (!ctx->error)
- ctx->error = g_steal_pointer (&error);
+ if (!mm_base_modem_at_command_finish (self, res, &ctx->saved_error)) {
+ mm_obj_warn (self, "couldn't configure context %d auth settings: %s", ctx->cid, ctx->saved_error->message);
+ /* Fallback to recover RF before returning the error */
+ ctx->step = SET_INITIAL_EPS_STEP_RF_ON;
+ } else {
+ /* Go to next step */
+ ctx->step++;
}
-
- /* Go to next step */
- ctx->step++;
set_initial_eps_step (task);
}
@@ -1079,19 +1078,18 @@ set_initial_eps_cgdcont_ready (MMBaseModem *self,
GAsyncResult *res,
GTask *task)
{
- g_autoptr(GError) error = NULL;
SetInitialEpsContext *ctx;
ctx = (SetInitialEpsContext *) g_task_get_task_data (task);
- if (!mm_base_modem_at_command_finish (self, res, &error)) {
- mm_obj_warn (self, "couldn't configure context %d settings: %s", ctx->cid, error->message);
- if (!ctx->error)
- ctx->error = g_steal_pointer (&error);
+ if (!mm_base_modem_at_command_finish (self, res, &ctx->saved_error)) {
+ mm_obj_warn (self, "couldn't configure context %d settings: %s", ctx->cid, ctx->saved_error->message);
+ /* Fallback to recover RF before returning the error */
+ ctx->step = SET_INITIAL_EPS_STEP_RF_ON;
+ } else {
+ /* Go to next step */
+ ctx->step++;
}
-
- /* Go to next step */
- ctx->step++;
set_initial_eps_step (task);
}
@@ -1189,10 +1187,6 @@ set_initial_eps_step (GTask *task)
self = g_task_get_source_object (task);
ctx = g_task_get_task_data (task);
- /* in case of error, skip all steps and restore radio if needed */
- if (ctx->error && ctx->step < SET_INITIAL_EPS_STEP_RF_ON)
- ctx->step = SET_INITIAL_EPS_STEP_RF_ON;
-
switch (ctx->step) {
case SET_INITIAL_EPS_STEP_FIRST:
ctx->step++;