On 07/01/13 19:53, Ben Chan wrote:
> Do you have any preference/suggestion on how we should approach this
> problem? I guess we may need to add additional checks in the code where
> it currently assumes a modem object in a fully initialized state.
> 

I don't think there should be many Firmware-related code (if any) where
we require a specific modem state. The attached patch (untested!!)
should allow launching the Firmware interface when the modem is in
Failed state. It should at least give some hints of where to start.

-- 
Aleksander
>From 959bb9d2ffb8bd7a3d701c21ec2cb58cab3717d9 Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksan...@lanedo.com>
Date: Mon, 7 Jan 2013 22:19:02 +0100
Subject: [PATCH] broadband-modem: launch the Firmware interface even on fatal
 errors

Even when there is a fatal error during initialization (e.g. missing PIN in a
3GPP modem), we should allow operations on the Firmware interface.
---
 src/mm-broadband-modem.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 11bc279..6563b4e 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -7678,8 +7678,9 @@ iface_modem_initialize_ready (MMBroadbandModem *self,
                                      MM_MODEM_STATE_FAILED,
                                      MM_MODEM_STATE_CHANGE_REASON_UNKNOWN);
 
-        /* Just jump to the last step */
-        ctx->step = INITIALIZE_STEP_LAST;
+        /* Jump to the firmware step. We allow firmware switching even in failed
+         * state */
+        ctx->step = INITIALIZE_STEP_IFACE_FIRMWARE;
         initialize_step (ctx);
         return;
     }
@@ -7873,7 +7874,8 @@ initialize_step (InitializeContext *ctx)
         return;
 
     case INITIALIZE_STEP_IFACE_SIMPLE:
-        mm_iface_modem_simple_initialize (MM_IFACE_MODEM_SIMPLE (ctx->self));
+        if (ctx->self->priv->modem_state != MM_MODEM_STATE_FAILED)
+            mm_iface_modem_simple_initialize (MM_IFACE_MODEM_SIMPLE (ctx->self));
         /* Fall down to next step */
         ctx->step++;
 
-- 
1.8.0.2

_______________________________________________
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to