aboutsummaryrefslogtreecommitdiff
path: root/plugins/cinterion/mm-modem-helpers-cinterion.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/cinterion/mm-modem-helpers-cinterion.c')
-rw-r--r--plugins/cinterion/mm-modem-helpers-cinterion.c63
1 files changed, 32 insertions, 31 deletions
diff --git a/plugins/cinterion/mm-modem-helpers-cinterion.c b/plugins/cinterion/mm-modem-helpers-cinterion.c
index 7bdc8c9e..5ceb4529 100644
--- a/plugins/cinterion/mm-modem-helpers-cinterion.c
+++ b/plugins/cinterion/mm-modem-helpers-cinterion.c
@@ -1457,44 +1457,45 @@ mm_cinterion_smoni_response_to_signal_info (const gchar *response,
* ^SCFG: "MEopMode/Prov/Cfg","tmode" -> t-mob germany
* OK
*/
-void
-mm_cinterion_provcfg_response_to_cid (const gchar *response,
- MMCinterionModemFamily modem_family,
- MMModemCharset charset,
- gpointer log_object,
- guint *cid)
+gboolean
+mm_cinterion_provcfg_response_to_cid (const gchar *response,
+ MMCinterionModemFamily modem_family,
+ MMModemCharset charset,
+ gpointer log_object,
+ gint *cid,
+ GError **error)
{
- g_autoptr(GRegex) r = NULL;
- g_autoptr(GMatchInfo) match_info = NULL;
- g_autofree GError *inner_error = NULL;
+ g_autoptr(GRegex) r = NULL;
+ g_autoptr(GMatchInfo) match_info = NULL;
+ g_autofree GError *inner_error = NULL;
+ g_autofree gchar *mno = NULL;
r = g_regex_new ("\\^SCFG:\\s*\"MEopMode/Prov/Cfg\",\\s*\"([0-9a-zA-Z]*)\"", 0, 0, NULL);
g_assert (r != NULL);
- g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &inner_error);
- if (inner_error)
- return;
- if (g_match_info_matches (match_info)) {
- g_autofree gchar *mno = NULL;
- mno = mm_get_string_unquoted_from_match_info (match_info, 1);
- if (mno && modem_family == MM_CINTERION_MODEM_FAMILY_IMT) {
- mno = mm_charset_take_and_convert_to_utf8 (mno, charset);
- mm_obj_dbg (log_object, "current mno: %s", mno);
- }
+ if (!g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, error))
+ return FALSE;
- /* for Cinterion LTE modules, some CID numbers have special meaning.
- * This is dictated by the chipset and by the MNO:
- * - the chipset uses a special one, CID 1, as a LTE combined attach chipset
- * - the MNOs can define the sequence and number of APN to be used for their network.
- * This takes priority over the chipset preferences, and therefore for some of them
- * the CID for the initial EPS context must be changed.
- */
- if (g_strcmp0 (mno, "2") == 0 || g_strcmp0 (mno, "vzwdcus") == 0)
- *cid = 3;
- else if (g_strcmp0 (mno, "tmode") == 0)
- *cid = 2;
- /* in all other cases no change to the preset value */
+ mno = mm_get_string_unquoted_from_match_info (match_info, 1);
+ if (mno && modem_family == MM_CINTERION_MODEM_FAMILY_IMT) {
+ mno = mm_charset_take_and_convert_to_utf8 (mno, charset);
+ mm_obj_dbg (log_object, "current mno: %s", mno);
}
+
+ /* for Cinterion LTE modules, some CID numbers have special meaning.
+ * This is dictated by the chipset and by the MNO:
+ * - the chipset uses a special one, CID 1, as a LTE combined attach chipset
+ * - the MNOs can define the sequence and number of APN to be used for their network.
+ * This takes priority over the chipset preferences, and therefore for some of them
+ * the CID for the initial EPS context must be changed.
+ */
+ if (g_strcmp0 (mno, "2") == 0 || g_strcmp0 (mno, "vzwdcus") == 0)
+ *cid = 3;
+ else if (g_strcmp0 (mno, "tmode") == 0)
+ *cid = 2;
+ else
+ *cid = 1;
+ return TRUE;
}
/*****************************************************************************/