[PATCH] mm-modem-mbm.c: add *E2NAP regexp to catch messages with error codes



Hi!

The following patch adds a new regular expression to be able to catch e2nap unsolicited messages containg an error code e.g. *E2NAP: 0,36. 
Without it, you could get weird responses for "get_imsi" etc where the E2NAP unsolicited message would be included in the response.

Regards
Torgny Johansson

diff --git a/plugins/mm-modem-mbm.c b/plugins/mm-modem-mbm.c
index ea7d876..feb3832 100644
--- a/plugins/mm-modem-mbm.c
+++ b/plugins/mm-modem-mbm.c
@@ -847,6 +847,10 @@ grab_port (MMModem *modem,
             regex = g_regex_new ("\\r\\n\\*E2NAP: (\\d)\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
             mm_at_serial_port_add_unsolicited_msg_handler (MM_AT_SERIAL_PORT (port), regex, mbm_e2nap_received, modem, NULL);
             g_regex_unref (regex);
+
+            regex = g_regex_new ("\\r\\n\\*E2NAP: (\\d),.*\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
+            mm_at_serial_port_add_unsolicited_msg_handler (MM_AT_SERIAL_PORT (port), regex, mbm_e2nap_received, modem, NULL);
+            g_regex_unref (regex);
         }
 
         regex = g_regex_new ("\\r\\n\\*EMRDY: \\d\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]