diff options
author | Dan Williams <dcbw@redhat.com> | 2016-03-15 10:33:30 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2016-03-15 10:41:49 -0500 |
commit | 602b3bb031f499bc06c5427000d5a181b372d0c9 (patch) | |
tree | b9137b1ab255534e64cbc8a11dddb2ddb622c0c6 | |
parent | 75da2d5df6c2506bbe2cc7e88c4c38d76340250a (diff) | |
download | ModemManager-dcbw/1-0-cgdcont-fixes.tar.gz |
modem-helpers: fix handling split PDP context ID reporting in CGDCONT=? responsedcbw/1-0-cgdcont-fixes
Cinterion PHS8-US devices send split PDP context ID like "(1-17,101-112)" and
that caused the modem-helpers to choke.
(cherry picked from commit 0a9cbf65ea285ebe58b27e1bf40d078504351a80)
-rw-r--r-- | src/mm-modem-helpers.c | 2 | ||||
-rw-r--r-- | src/tests/test-modem-helpers.c | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index 6f1fa5737..1a5f60d09 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -773,7 +773,7 @@ mm_3gpp_parse_cgdcont_test_response (const gchar *response, return NULL; } - r = g_regex_new ("\\+CGDCONT:\\s*\\(\\s*(\\d+)\\s*-?\\s*(\\d+)?\\s*\\)\\s*,\\s*\\(?\"(\\S+)\"", + r = g_regex_new ("\\+CGDCONT:\\s*\\(\\s*(\\d+)\\s*-?\\s*(\\d+)?[^\\)]*\\)\\s*,\\s*\\(?\"(\\S+)\"", G_REGEX_DOLLAR_ENDONLY | G_REGEX_RAW, 0, &inner_error); g_assert (r != NULL); diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c index 58a59e2e0..3614f8314 100644 --- a/src/tests/test-modem-helpers.c +++ b/src/tests/test-modem-helpers.c @@ -1655,6 +1655,21 @@ test_cgdcont_test_response_thuraya (void *f, gpointer d) test_cgdcont_test_results ("Thuraya", reply, &expected[0], G_N_ELEMENTS (expected)); } + +static void +test_cgdcont_test_response_cinterion_phs8 (void *f, gpointer d) +{ + const gchar *reply = + "+CGDCONT: (1-17,101-116),\"IP\",,,(0),(0-4)\r\n"; + static MM3gppPdpContextFormat expected[] = { + { 1, 17, MM_BEARER_IP_FAMILY_IPV4 } + }; + + test_cgdcont_test_results ("Cinterion PHS8-USA REVISION 03.001", reply, &expected[0], G_N_ELEMENTS (expected)); +} + + + /*****************************************************************************/ /* Test CGDCONT read responses */ @@ -2376,6 +2391,7 @@ int main (int argc, char **argv) g_test_suite_add (suite, TESTCASE (test_cgdcont_test_response_multiple_and_ignore, NULL)); g_test_suite_add (suite, TESTCASE (test_cgdcont_test_response_single_context, NULL)); g_test_suite_add (suite, TESTCASE (test_cgdcont_test_response_thuraya, NULL)); + g_test_suite_add (suite, TESTCASE (test_cgdcont_test_response_cinterion_phs8, NULL)); g_test_suite_add (suite, TESTCASE (test_cgdcont_read_response_nokia, NULL)); g_test_suite_add (suite, TESTCASE (test_cgdcont_read_response_samsung, NULL)); |