[PATCH] update signal quality correctly when out of coverage

Prathmesh Prabhu Chromium pprabhu at chromium.org
Tue Oct 22 14:34:41 PDT 2013


I'm OK with either approach.

I like the one that does not raise the error better, since the
interpretation of 99 really belongs in the implementation rather than the
interface.


On Tue, Oct 22, 2013 at 2:23 PM, Dan Williams <dcbw at redhat.com> wrote:

> On Tue, 2013-10-22 at 12:17 -0700, Prathmesh Prabhu wrote:
> > When querying signal quality using AT+CSQ, a response of '+CSQ:99,99'
> indicates no
> > network. This should lead to the signal quality being set to 0. Before
> this
> > patch, the last most recent signal quality would be left untouched.
>
> Instead, how about we just want to ditch the NO_NETWORK bits in
> mm-broadband-mode.c::signal_quality_csq_ready() and just report 0 signal
> when CSQ returns 99?  There was no good reason NO_NETWORK was used,
> except that in MM 0.6 and earlier it was returned directly to callers.
> But now in MM 1.0, the error is only consumed by MM itself, internally,
> so there's no point to it.  So maybe just:
>
>         if (sscanf (result_str, "%d, %d", &quality, &ber)) {
>             if (quality == 99) {
>                 /* 99 means unknown */
>                 quality = 0;
>             } else {
>                 /* Normalize it */
>                 quality = CLAMP (quality, 0, 31) * 100 / 31;
>             }
>             g_simple_async_result_set_op_res_gpointer (ctx->result,
>                                                        GUINT_TO_POINTER
> (quality),
>                                                        NULL);
>
> or something like that.  What do you think?
>
> Dan
>
> > ---
> >  src/mm-iface-modem.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
> > index 433dbac..ea433ed 100644
> > --- a/src/mm-iface-modem.c
> > +++ b/src/mm-iface-modem.c
> > @@ -1169,7 +1169,16 @@ signal_quality_check_ready (MMIfaceModem *self,
> >
>                res,
> >
>                &error);
> >      if (error) {
> > -        mm_dbg ("Couldn't refresh signal quality: '%s'",
> error->message);
> > +        /* If we failed to update signal quality because there was no
> network,
> > +         * we should set the signal quality to zero to reflect no
> network
> > +         * coverage.
> > +         */
> > +        if (error->code == MM_MOBILE_EQUIPMENT_ERROR_NO_NETWORK) {
> > +            mm_dbg ("Out of coverage area. Setting signal quality to
> '0'");
> > +            update_signal_quality (self, 0, TRUE);
> > +        } else {
> > +            mm_dbg ("Couldn't refresh signal quality: '%s'",
> error->message);
> > +        }
> >          g_error_free (error);
> >      } else
> >          update_signal_quality (self, signal_quality, TRUE);
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/modemmanager-devel/attachments/20131022/987c207e/attachment.html>


More information about the ModemManager-devel mailing list