[MM] Power down during init (was: Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down)
- From: Aleksander Morgado <aleksander lanedo com>
- To: Dan Williams <dcbw redhat com>, Marius Kotsbak <marius kotsbak gmail com>
- Cc: "networkmanager-list gnome org" <networkmanager-list gnome org>
- Subject: [MM] Power down during init (was: Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down)
- Date: Tue, 18 Sep 2012 16:24:42 +0200
Hey Dan and Marius,
>
>> Power Up = enabled
>> Power Down = disabled
>>
>> So we already have those states in ModemManager via the Enable() method
>> and the modem states. It's just that not all devices actually implement
>> the low-power mode when disabling, partially because we're not always
>> sure of the side-effects.
>>
>
> The problem here isn't that we don't have a safe power-down command; the
> problem is that even if we have it, we don't use it just after plugging
> in the modem:
> initialized -> locked -> disabled
>
> But for that 'disabled' state we didn't run the power-down command even
> if we have it, so the radio interface may be powered on there. That's
> the thing to fix by running the disabling sequence just after
> initialization. If there is no default power down command, then we would
> run the disabling sequence but without any power down command, so no big
> deal.
>
The attached patch runs just a new power-down step during the modem
initialization, to ensure it starts in low power mode. Adding a new step
to run power-down instead of running the whole disabling sequence seemed
a better option, as the disabling sequence really assumes we were
previously enabled. Note that this patch just re-uses the power-down
implementation given in each plugin, which we previously used only
during the disabling sequence.
Given that it's quite a big change, can you guys try it with some of the
modems that we know have given issues before with these things? Thinking
on Sierra modems specifically here. I've got a Wavecom modem which also
had issues with CFUN (e.g. rebooting on CFUN=1 if it was already in
CFUN=1), but won't be able to test it until Friday.
Cheers!
--
Aleksander
>From 99e070b97aeacd47c119e5b9a5eeeb9033eba9f5 Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksander lanedo com>
Date: Tue, 18 Sep 2012 16:09:54 +0200
Subject: [PATCH] iface-modem: ensure we're in low power mode when
initializing
---
src/mm-iface-modem.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 5a2b2bd..2b76914 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -2934,6 +2934,7 @@ static void interface_initialization_step (InitializationContext *ctx);
typedef enum {
INITIALIZATION_STEP_FIRST,
+ INITIALIZATION_STEP_POWER_DOWN,
INITIALIZATION_STEP_CURRENT_CAPABILITIES,
INITIALIZATION_STEP_MODEM_CAPABILITIES,
INITIALIZATION_STEP_BEARERS,
@@ -3009,6 +3010,25 @@ initialization_context_complete_and_free_if_cancelled (InitializationContext *ct
return TRUE;
}
+static void
+initialization_modem_power_down_ready (MMIfaceModem *self,
+ GAsyncResult *res,
+ InitializationContext *ctx)
+{
+ GError *error = NULL;
+
+ MM_IFACE_MODEM_GET_INTERFACE (self)->modem_power_down_finish (self, res, &error);
+ if (error) {
+ mm_dbg ("Couldn't power down the modem during initialization: '%s'", error->message);
+ g_error_free (error);
+ } else
+ mm_dbg ("Modem initially powered down...");
+
+ /* Go on to next step */
+ ctx->step++;
+ interface_initialization_step (ctx);
+}
+
#undef STR_REPLY_READY_FN
#define STR_REPLY_READY_FN(NAME,DISPLAY) \
static void \
@@ -3280,6 +3300,20 @@ interface_initialization_step (InitializationContext *ctx)
/* Fall down to next step */
ctx->step++;
+ case INITIALIZATION_STEP_POWER_DOWN:
+ /* We run the power down command during initialization, to ensure we
+ * start with radio off, when possible */
+ if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_power_down &&
+ MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_power_down_finish) {
+ MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_power_down (
+ ctx->self,
+ (GAsyncReadyCallback)initialization_modem_power_down_ready,
+ ctx);
+ return;
+ }
+ /* Fall down to next step */
+ ctx->step++;
+
case INITIALIZATION_STEP_CURRENT_CAPABILITIES:
/* Current capabilities may change during runtime, i.e. if new firmware reloaded; but we'll
* try to handle that by making sure the capabilities are cleared when the new firmware is
--
1.7.11.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]