[PATCH] broadband-modem: report signal quality as 0 when no service/unknown/etc
Prathmesh Prabhu Chromium
pprabhu at chromium.org
Wed Oct 23 13:15:42 PDT 2013
sweet, I'm happy to see this go in. This will fix a currently existing
possibility of getting stale signal quality when NO_NETWORK condition
occurs.
Thanks,
Prathmesh
On Wed, Oct 23, 2013 at 9:29 AM, Aleksander Morgado
<aleksander at lanedo.com>wrote:
> On 10/23/2013 06:26 PM, Dan Williams wrote:
> > Instead of using the NO_NETWORK error, which is only ever read
> > internally by ModemManager and not very useful when reading quality,
> > just report signal quality as zero. Before MM 1.0, the signal quality
> > could be explicitly requested by clients, so the NO_NETWORK error was of
> > some use, but now that the quality is updated automatically by MM and is
> > a property instead of a D-Bus method call, the error is pointless.
> >
> > ---
>
> Makes total sense, yes. +1 from me.
>
>
> > diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
> > index 32fa672..9d5a2b0 100644
> > --- a/src/mm-broadband-modem.c
> > +++ b/src/mm-broadband-modem.c
> > @@ -1739,27 +1739,24 @@ signal_quality_csq_ready (MMBroadbandModem *self,
> > if (result_str) {
> > /* Got valid reply */
> > int quality;
> > int ber;
> >
> > result_str = mm_strip_tag (result_str, "+CSQ:");
> > if (sscanf (result_str, "%d, %d", &quality, &ber)) {
> > - /* 99 means unknown */
> > if (quality == 99) {
> > - g_simple_async_result_take_error (
> > - ctx->result,
> > - mm_mobile_equipment_error_for_code
> (MM_MOBILE_EQUIPMENT_ERROR_NO_NETWORK));
> > + /* 99 means unknown, no service, etc */
> > + quality = 0;
> > } else {
> > /* Normalize the quality */
> > quality = CLAMP (quality, 0, 31) * 100 / 31;
> > - g_simple_async_result_set_op_res_gpointer (ctx->result,
> > -
> GUINT_TO_POINTER (quality),
> > - NULL);
> > }
> > -
> > + g_simple_async_result_set_op_res_gpointer (ctx->result,
> > + GUINT_TO_POINTER
> (quality),
> > + NULL);
> > signal_quality_context_complete_and_free (ctx);
> > return;
> > }
> > }
> >
> > g_simple_async_result_set_error (ctx->result,
> > MM_CORE_ERROR,
> >
> > _______________________________________________
> > ModemManager-devel mailing list
> > ModemManager-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
> >
>
>
> --
> Aleksander
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/modemmanager-devel/attachments/20131023/32c46156/attachment.html>
More information about the ModemManager-devel
mailing list