aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2012-01-09 12:42:51 -0600
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:48 +0100
commit98755bd508fd7476ebfc6700b283bda8648b4ea5 (patch)
treea42c7c1c6542b4e46c2c75a838199fbad8b69f2d
parentcb2d6d610524f32fd95633e4a491ba88f983e956 (diff)
broadband-modem: ignore early AT error responses for modem info
Where we have multiple commands that are all supposed to return the same thing (ie, GMM/CGMM, CSQ/CSQ?) but some modems support one and not the other, don't exit the sequence early if the modem doesn't support one of them. Gobi modems with CDMA firmware don't support the Cxxx variants so the returned ERROR (CME error 100) made the generic parser break out of the AT sequence without trying the additional commands that are supported.
-rw-r--r--src/mm-broadband-modem.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 18c6a0b2..dee86b09 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -115,6 +115,30 @@ struct _MMBroadbandModemPrivate {
};
/*****************************************************************************/
+
+static gboolean
+response_processor_string_ignore_at_errors (MMBaseModem *self,
+ gpointer none,
+ const gchar *command,
+ const gchar *response,
+ gboolean last_command,
+ const GError *error,
+ GVariant **result,
+ GError **result_error)
+{
+ if (error) {
+ /* Ignore AT errors (ie, ERROR or CMx ERROR) */
+ if (error->domain != MM_MOBILE_EQUIPMENT_ERROR || last_command)
+ *result_error = g_error_copy (error);
+
+ return FALSE;
+ }
+
+ *result = g_variant_new_string (response);
+ return TRUE;
+}
+
+/*****************************************************************************/
/* CREATE BEARER */
static MMBearer *
@@ -481,8 +505,8 @@ load_manufacturer_finish (MMIfaceModem *self,
}
static const MMBaseModemAtCommand manufacturers[] = {
- { "+CGMI", 3, TRUE, mm_base_modem_response_processor_string },
- { "+GMI", 3, TRUE, mm_base_modem_response_processor_string },
+ { "+CGMI", 3, TRUE, response_processor_string_ignore_at_errors },
+ { "+GMI", 3, TRUE, response_processor_string_ignore_at_errors },
{ NULL }
};
@@ -523,8 +547,8 @@ load_model_finish (MMIfaceModem *self,
}
static const MMBaseModemAtCommand models[] = {
- { "+CGMM", 3, TRUE, mm_base_modem_response_processor_string },
- { "+GMM", 3, TRUE, mm_base_modem_response_processor_string },
+ { "+CGMM", 3, TRUE, response_processor_string_ignore_at_errors },
+ { "+GMM", 3, TRUE, response_processor_string_ignore_at_errors },
{ NULL }
};
@@ -565,8 +589,8 @@ load_revision_finish (MMIfaceModem *self,
}
static const MMBaseModemAtCommand revisions[] = {
- { "+CGMR", 3, TRUE, mm_base_modem_response_processor_string },
- { "+GMR", 3, TRUE, mm_base_modem_response_processor_string },
+ { "+CGMR", 3, TRUE, response_processor_string_ignore_at_errors },
+ { "+GMR", 3, TRUE, response_processor_string_ignore_at_errors },
{ NULL }
};
@@ -607,8 +631,8 @@ load_equipment_identifier_finish (MMIfaceModem *self,
}
static const MMBaseModemAtCommand equipment_identifiers[] = {
- { "+CGSN", 3, TRUE, mm_base_modem_response_processor_string },
- { "+GSN", 3, TRUE, mm_base_modem_response_processor_string },
+ { "+CGSN", 3, TRUE, response_processor_string_ignore_at_errors },
+ { "+GSN", 3, TRUE, response_processor_string_ignore_at_errors },
{ NULL }
};
@@ -988,8 +1012,8 @@ load_signal_quality_csq_ready (MMBroadbandModem *self,
* try the other command if the first one fails.
*/
static const MMBaseModemAtCommand signal_quality_csq[] = {
- { "+CSQ", 3, TRUE, mm_base_modem_response_processor_string },
- { "+CSQ?", 3, TRUE, mm_base_modem_response_processor_string },
+ { "+CSQ", 3, TRUE, response_processor_string_ignore_at_errors },
+ { "+CSQ?", 3, TRUE, response_processor_string_ignore_at_errors },
{ NULL }
};