broadband-modem: report signal quality as 0 when no service/unknown/etc
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.
This commit is contained in:
@@ -1743,19 +1743,16 @@ signal_quality_csq_ready (MMBroadbandModem *self,
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user