aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mm-broadband-modem.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index c31b0037..8fb15644 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -11003,26 +11003,28 @@ disabling_stopped (MMBroadbandModem *self,
/*****************************************************************************/
/* Initializing the modem (during first enabling) */
-static gboolean
-enabling_modem_init_finish (MMBroadbandModem *self,
- GAsyncResult *res,
- GError **error)
-{
- return !!mm_base_modem_at_command_full_finish (MM_BASE_MODEM (self), res, error);
-}
-
static void
-enabling_modem_init (MMBroadbandModem *self,
- GAsyncReadyCallback callback,
- gpointer user_data)
+enabling_modem_init (MMBroadbandModem *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
+ MMPortSerialAt *primary;
+
+ primary = mm_base_modem_peek_port_primary (MM_BASE_MODEM (self));
+ if (!primary) {
+ g_task_report_new_error (self, callback, user_data, enabling_modem_init,
+ MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "Failed to run init command: primary port missing");
+ return;
+ }
+
/* Init command. ITU rec v.250 (6.1.1) says:
* The DTE should not include additional commands on the same command line
* after the Z command because such commands may be ignored.
* So run ATZ alone.
*/
mm_base_modem_at_command_full (MM_BASE_MODEM (self),
- mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)),
+ primary,
"Z",
6,
FALSE,
@@ -11032,6 +11034,17 @@ enabling_modem_init (MMBroadbandModem *self,
user_data);
}
+static gboolean
+enabling_modem_init_finish (MMBroadbandModem *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ if (g_async_result_is_tagged (res, enabling_modem_init))
+ return g_task_propagate_boolean (G_TASK (res), error);
+
+ return !!mm_base_modem_at_command_full_finish (MM_BASE_MODEM (self), res, error);
+}
+
/*****************************************************************************/
/* Enabling started */