[PATCH] huawei: treat CFUN 0 as low power state

Dan Williams dcbw at redhat.com
Thu May 1 08:27:08 PDT 2014


On Thu, 2014-05-01 at 17:18 +0200, Aleksander Morgado wrote:
> On 04/30/2014 09:59 AM, Ben Chan wrote:
> > The Huawei plugin uses +CFUN=0 to put the modem in low power mode as
> > +CFUN=4 isn't supported by all Huawei modems. This patch modifies the
> > plugin to treat CFUN 0 as the 'LOW' power state, which is necessary as
> > otherwise ModemManager would prevent the modem from transitioning to the
> > 'ON' power state.
> > ---
> 
> Pushed, thanks.

Just for the record, belated ACK from me.  Tested EC168C and EC121 and
with both, CFUN=0 results in QCDM "low-power" mode, while CFUN=4 on the
EC121 is "offline" mode.  The EC168C does not support CFUN=4 at all.

Dan

> 
> >  plugins/huawei/mm-broadband-modem-huawei.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c
> > index b7b98a8..fe8e600 100644
> > --- a/plugins/huawei/mm-broadband-modem-huawei.c
> > +++ b/plugins/huawei/mm-broadband-modem-huawei.c
> > @@ -2845,8 +2845,15 @@ parent_load_power_state_ready (MMIfaceModem *self,
> >      power_state = iface_modem_parent->load_power_state_finish (self, res, &error);
> >      if (error)
> >          g_simple_async_result_take_error (result, error);
> > -    else
> > +    else {
> > +        /* As modem_power_down uses +CFUN=0 to put the modem in low state, we treat
> > +         * CFUN 0 as 'LOW' power state instead of 'OFF'. Otherwise, MMIfaceModem
> > +         * would prevent the modem from transitioning back to the 'ON' power state. */
> > +        if (power_state == MM_MODEM_POWER_STATE_OFF)
> > +            power_state = MM_MODEM_POWER_STATE_LOW;
> > +
> >          g_simple_async_result_set_op_res_gpointer (result, GUINT_TO_POINTER (power_state), NULL);
> > +    }
> >  
> >      g_simple_async_result_complete (result);
> >      g_object_unref (result);
> > @@ -3023,6 +3030,8 @@ huawei_modem_power_down (MMIfaceModem *self,
> >  {
> >      switch (MM_BROADBAND_MODEM_HUAWEI (self)->priv->rfswitch_support) {
> >      case FEATURE_NOT_SUPPORTED:
> > +        /* +CFUN=0 is supported on all Huawei modems but +CFUN=4 isn't,
> > +         * thus we use +CFUN=0 to put the modem in low power state. */
> >          mm_base_modem_at_command (MM_BASE_MODEM (self),
> >                                    "+CFUN=0",
> >                                    30,
> > 
> 
> 




More information about the ModemManager-devel mailing list