[PATH]: modem-manager: fix for coldstart connect problem + parser hooks for unsolicited msgs




Index: plugins/mm-modem-mbm.c
===================================================================
--- plugins/mm-modem-mbm.c	(revision 809)
+++ plugins/mm-modem-mbm.c	(revision 816)
@@ -42,6 +42,9 @@
 
 typedef struct {
     char *network_device;
+    GRegex *boot_trig_regex;
+    GRegex *msg_waiting_regex;
+    gpointer std_parser;
 } MMModemMbmPrivate;
 
 enum {
@@ -245,8 +248,38 @@
 /*****************************************************************************/
 
 static void
+boot_trig (const char *str, gpointer data)
+{
+    mm_serial_queue_command (MM_SERIAL(data), "AT*ENAP=1,1", 10, NULL, NULL);
+}
+
+static void
+msg_waiting (const char *str, gpointer data)
+{
+}
+
+static gboolean
+mbm_parse_response (gpointer data, GString *response, GError **error)
+{
+    MMModemMbmPrivate *priv = MM_MODEM_MBM_GET_PRIVATE (data);
+
+    mm_util_strip_string (response, priv->boot_trig_regex, boot_trig, data);
+    mm_util_strip_string (response, priv->msg_waiting_regex, msg_waiting, data);
+
+    return mm_serial_parser_v1_parse (priv->std_parser, response, error);
+}
+
+static void
 mm_modem_mbm_init (MMModemMbm *self)
 {
+    MMModemMbmPrivate *priv = MM_MODEM_MBM_GET_PRIVATE (self);
+
+    priv->boot_trig_regex = g_regex_new ("\\r\\n\\+PACSP0\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
+    priv->msg_waiting_regex = g_regex_new ("\\r\\n[\\*]EMWI\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
+
+    priv->std_parser = mm_serial_parser_v1_new ();
+
+    mm_serial_set_response_parser (MM_SERIAL (self), mbm_parse_response, self, NULL);
 }
 
 static void


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