[PATCH] broadband-modem: report signal quality as 0 when no service/unknown/etc
Dan Williams
dcbw at redhat.com
Wed Oct 23 17:39:55 PDT 2013
On Wed, 2013-10-23 at 13:15 -0700, Prathmesh Prabhu Chromium wrote:
> 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.
Pushed my patch.
Dan
> 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
> >
> _______________________________________________
> ModemManager-devel mailing list
> ModemManager-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
More information about the ModemManager-devel
mailing list