[PATCH 1/2] allow optional quotes in +CREG: <stat>,"<lac>","<ci>" (GSM 07.07 CREG=2 unsolicited) pattern; add testcase for Thuraya XT
Thomas Sailer
sailer at sailer.dynip.lugs.ch
Fri Feb 12 11:43:04 UTC 2016
From: Thomas Sailer <t.sailer at alumni.ethz.ch>
Signed-off-by: Thomas Sailer <t.sailer at alumni.ethz.ch>
---
src/mm-modem-helpers.c | 2 +-
src/tests/test-modem-helpers.c | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index 0331aa7..bb7837e 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -433,7 +433,7 @@ mm_voice_clip_regex_get (void)
#define CREG2 "\\+(CREG|CGREG|CEREG):\\s*0*([0-9]),\\s*0*([0-9])"
/* +CREG: <stat>,<lac>,<ci> (GSM 07.07 CREG=2 unsolicited) */
-#define CREG3 "\\+(CREG|CGREG|CEREG):\\s*0*([0-9]),\\s*([^,\\s]*)\\s*,\\s*([^,\\s]*)"
+#define CREG3 "\\+(CREG|CGREG|CEREG):\\s*0*([0-9]),\\s*(?|([^,\\s]*)|(?:\"([^\"]*)\"))\\s*,\\s*(?|([^,\\s]*)|(?:\"([^\"]*)\"))"
/* +CREG: <n>,<stat>,<lac>,<ci> (GSM 07.07 solicited and some CREG=2 unsolicited) */
#define CREG4 "\\+(CREG|CGREG|CEREG):\\s*([0-9]),\\s*([0-9])\\s*,\\s*([^,]*)\\s*,\\s*([^,\\s]*)"
diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c
index 82479ac..4dc5662 100644
--- a/src/tests/test-modem-helpers.c
+++ b/src/tests/test-modem-helpers.c
@@ -1071,6 +1071,16 @@ test_cgreg2_unsolicited_with_rac (void *f, gpointer d)
}
static void
+test_cgreg2_thuraya_unsolicited (void *f, gpointer d)
+{
+ RegTestData *data = (RegTestData *) d;
+ const char *reply = "\r\n+CGREG: 1, \"0426\", \"F0,0F\"\r\n";
+ const CregResult result = { 1, 0x0426, 0xF0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 3, TRUE, FALSE };
+
+ test_creg_match ("Thuraya CGREG=2", FALSE, reply, data, &result);
+}
+
+static void
test_cereg1_solicited (void *f, gpointer d)
{
RegTestData *data = (RegTestData *) d;
@@ -2706,6 +2716,7 @@ int main (int argc, char **argv)
g_test_suite_add (suite, TESTCASE (test_cgreg2_md400_unsolicited, reg_data));
g_test_suite_add (suite, TESTCASE (test_cgreg2_x220_unsolicited, reg_data));
g_test_suite_add (suite, TESTCASE (test_cgreg2_unsolicited_with_rac, reg_data));
+ g_test_suite_add (suite, TESTCASE (test_cgreg2_thuraya_unsolicited, reg_data));
g_test_suite_add (suite, TESTCASE (test_cereg1_solicited, reg_data));
g_test_suite_add (suite, TESTCASE (test_cereg1_unsolicited, reg_data));
--
2.5.0
More information about the ModemManager-devel
mailing list