[PATCH] broadband-bearer: run init sequence after flashing in disconnection

Aleksander Morgado aleksander at aleksander.es
Tue Jul 25 12:48:02 UTC 2017


The init-sequence configured for the TTY that is being used as data
port must not be launched during the port reopen() sequence; instead
we must run it manually after the port flashing has finished.
---

Hey Tim & Dan,

What do you think of this change? It should clear up the mixup of commands sent while flashing is ongoing.

Cheers!

---
 src/mm-broadband-bearer.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c
index c4f92b99..bf42d3da 100644
--- a/src/mm-broadband-bearer.c
+++ b/src/mm-broadband-bearer.c
@@ -1462,6 +1462,9 @@ data_flash_cdma_ready (MMPortSerial *data,
         g_error_free (error);
     }

+    /* Run init port sequence in the data port */
+    mm_port_serial_at_run_init_sequence (MM_PORT_SERIAL_AT (data));
+
     g_task_return_boolean (task, TRUE);
     g_object_unref (task);
 }
@@ -1474,6 +1477,8 @@ data_reopen_cdma_ready (MMPortSerial *data,
     DetailedDisconnectContext *ctx;
     GError *error = NULL;

+    g_object_set (data, MM_PORT_SERIAL_AT_INIT_SEQUENCE_ENABLED, TRUE, NULL);
+
     if (!mm_port_serial_reopen_finish (data, res, &error)) {
         /* Fatal */
         g_task_return_error (task, error);
@@ -1514,6 +1519,10 @@ disconnect_cdma (MMBroadbandBearer *self,
     task = g_task_new (self, NULL, callback, user_data);
     g_task_set_task_data (task, ctx, (GDestroyNotify)detailed_disconnect_context_free);

+    /* We don't want to run init sequence right away during the reopen, as we're
+     * going to flash afterwards. */
+    g_object_set (data, MM_PORT_SERIAL_AT_INIT_SEQUENCE_ENABLED, FALSE, NULL);
+
     /* Fully reopen the port before flashing */
     mm_dbg ("Reopening data port (%s)...", mm_port_get_device (MM_PORT (ctx->data)));
     mm_port_serial_reopen (MM_PORT_SERIAL (ctx->data),
@@ -1595,6 +1604,9 @@ data_flash_3gpp_ready (MMPortSerial *data,
         g_error_free (error);
     }

+    /* Run init port sequence in the data port */
+    mm_port_serial_at_run_init_sequence (MM_PORT_SERIAL_AT (data));
+
     /* Don't bother doing the CGACT again if it was already done on the
      * primary or secondary port */
     if (ctx->cgact_sent) {
@@ -1633,6 +1645,8 @@ data_reopen_3gpp_ready (MMPortSerial *data,
     DetailedDisconnectContext *ctx;
     GError *error = NULL;

+    g_object_set (data, MM_PORT_SERIAL_AT_INIT_SEQUENCE_ENABLED, TRUE, NULL);
+
     if (!mm_port_serial_reopen_finish (data, res, &error)) {
         /* Fatal */
         g_task_return_error (task, error);
@@ -1658,6 +1672,10 @@ data_reopen_3gpp (GTask *task)

     ctx = g_task_get_task_data (task);

+    /* We don't want to run init sequence right away during the reopen, as we're
+     * going to flash afterwards. */
+    g_object_set (ctx->data, MM_PORT_SERIAL_AT_INIT_SEQUENCE_ENABLED, FALSE, NULL);
+
     /* Fully reopen the port before flashing */
     mm_dbg ("Reopening data port (%s)...", mm_port_get_device (MM_PORT (ctx->data)));
     mm_port_serial_reopen (MM_PORT_SERIAL (ctx->data),
--
2.13.1


More information about the ModemManager-devel mailing list