broadband-modem: more compatible CSQ parsing

Some devices (usually CDMA modems like the Sierra MC5725 and others)
don't prefix their +CSQ replies with +CSQ.  So don't require that.
The scanf() should ensure the reply is valid even without the +CSQ.
This commit is contained in:
Dan Williams
2013-01-14 13:50:26 -06:00
parent 48b36b1afa
commit 01e8e0574f
+3 -3
View File
@@ -1473,13 +1473,13 @@ signal_quality_csq_ready (MMBroadbandModem *self,
}
result_str = g_variant_get_string (result, NULL);
if (result_str &&
!strncmp (result_str, "+CSQ: ", 6)) {
if (result_str) {
/* Got valid reply */
int quality;
int ber;
if (sscanf (result_str + 6, "%d, %d", &quality, &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 (