Re: [MM] [PATCH 2/2] novatel-lte: skip soft reset if modem is newly plugged in



Hey Ben,

Some thoughts about this patch (which is already merged).

On 01/18/2013 08:11 AM, Ben Chan wrote:
+static void
+modem_init (MMIfaceModem *self,
+            GAsyncReadyCallback callback,
+            gpointer user_data)
+{
+    MMAtSerialPort *primary;
+    GSimpleAsyncResult *result;
+    guint init_sequence_index;
+
+    result = g_simple_async_result_new (G_OBJECT (self),
+                                        callback,
+                                        user_data,
+                                        modem_init);
+
+    primary = mm_base_modem_peek_port_primary (MM_BASE_MODEM (self));
+    if (!primary) {
+        g_simple_async_result_set_error (
+            result,
+            MM_CORE_ERROR,
+            MM_CORE_ERROR_FAILED,
+            "Need primary AT port to run modem init sequence");
+        g_simple_async_result_complete_in_idle (result);
+        g_object_unref (result);
+        return;
+    }
+
+    /* Skip ATZ if the device was hotplugged. */
+    init_sequence_index = mm_base_modem_get_hotplugged (MM_BASE_MODEM (self)) ? 1 : 0;
+
+    mm_base_modem_at_sequence_full (MM_BASE_MODEM (self),
+                                    primary,
+                                    &modem_init_sequence[init_sequence_index],
+                                    NULL,  /* response_processor_context */
+                                    NULL,  /* response_processor_context_free */
+                                    NULL, /* cancellable */
+                                    (GAsyncReadyCallback)modem_init_sequence_ready,
+                                    result);

Just wondering, shouldn't you reset the 'hotplugged' property in the
base modem as soon as you check it the first time? If it's left set to
TRUE, ATZ will not be sent after disabling and re-enabling the modem.

-- 
Aleksander


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