[PATCH] broadband-modem: report signal quality as 0 when no service/unknown/etc

Dan Williams dcbw at redhat.com
Wed Oct 23 09:26:56 PDT 2013


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.

---
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,



More information about the ModemManager-devel mailing list