broadband-modem: fall back to +CSQ if +CIND reports no signal
This is the port to git master of the following commit: commit 8bd6903c30e52e65a4afbebf85ba59e6c0fada71 Author: Dan Williams <dcbw@redhat.com> Date: Thu Oct 4 09:34:01 2012 -0500 gsm: fall back to +CSQ if +CIND reports no signal (bgo #636040) Some devices say they support +CIND signal reporting, but either actually don't, or they report signal for a non-current access technology that we don't care about. So if +CIND reports zero signal, fall back to +CSQ.
This commit is contained in:
@@ -1424,28 +1424,19 @@ signal_quality_cind_ready (MMBroadbandModem *self,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
const gchar *result;
|
const gchar *result;
|
||||||
GByteArray *indicators;
|
GByteArray *indicators;
|
||||||
|
guint quality;
|
||||||
|
|
||||||
result = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
|
result = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
|
||||||
if (!error)
|
if (!error)
|
||||||
indicators = mm_3gpp_parse_cind_read_response (result, &error);
|
indicators = mm_3gpp_parse_cind_read_response (result, &error);
|
||||||
|
|
||||||
if (error)
|
if (error) {
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_simple_async_result_take_error (ctx->result, error);
|
||||||
else if (indicators->len >= self->priv->modem_cind_indicator_signal_quality) {
|
signal_quality_context_complete_and_free (ctx);
|
||||||
guint quality;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
quality = g_array_index (indicators,
|
if (indicators->len < self->priv->modem_cind_indicator_signal_quality) {
|
||||||
guint8,
|
|
||||||
self->priv->modem_cind_indicator_signal_quality);
|
|
||||||
quality = normalize_ciev_cind_signal_quality (quality,
|
|
||||||
self->priv->modem_cind_min_signal_quality,
|
|
||||||
self->priv->modem_cind_max_signal_quality);
|
|
||||||
g_simple_async_result_set_op_res_gpointer (ctx->result,
|
|
||||||
GUINT_TO_POINTER (quality),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
g_byte_array_free (indicators, TRUE);
|
|
||||||
} else
|
|
||||||
g_simple_async_result_set_error (ctx->result,
|
g_simple_async_result_set_error (ctx->result,
|
||||||
MM_CORE_ERROR,
|
MM_CORE_ERROR,
|
||||||
MM_CORE_ERROR_FAILED,
|
MM_CORE_ERROR_FAILED,
|
||||||
@@ -1453,7 +1444,32 @@ signal_quality_cind_ready (MMBroadbandModem *self,
|
|||||||
"signal index (%u) outside received range (0-%u)",
|
"signal index (%u) outside received range (0-%u)",
|
||||||
self->priv->modem_cind_indicator_signal_quality,
|
self->priv->modem_cind_indicator_signal_quality,
|
||||||
indicators->len);
|
indicators->len);
|
||||||
|
g_byte_array_free (indicators, TRUE);
|
||||||
|
signal_quality_context_complete_and_free (ctx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
quality = g_array_index (indicators,
|
||||||
|
guint8,
|
||||||
|
self->priv->modem_cind_indicator_signal_quality);
|
||||||
|
g_byte_array_free (indicators, TRUE);
|
||||||
|
|
||||||
|
quality = normalize_ciev_cind_signal_quality (quality,
|
||||||
|
self->priv->modem_cind_min_signal_quality,
|
||||||
|
self->priv->modem_cind_max_signal_quality);
|
||||||
|
|
||||||
|
/* Some LTE devices say they support signal via CIND,
|
||||||
|
* but always report zero even though they have signal. So
|
||||||
|
* if we get zero signal, try CSQ too. (bgo #636040)
|
||||||
|
*/
|
||||||
|
if (quality == 0) {
|
||||||
|
signal_quality_csq (ctx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_simple_async_result_set_op_res_gpointer (ctx->result,
|
||||||
|
GUINT_TO_POINTER (quality),
|
||||||
|
NULL);
|
||||||
signal_quality_context_complete_and_free (ctx);
|
signal_quality_context_complete_and_free (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user