From d593116d68ecda7fc0ef67e7399d0588cde60a38 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 18 Feb 2013 16:06:01 +0100 Subject: base-modem: don't run port init sequence if we're just sending a command This may happen when sending commands to the modem while in non-enabled state, like when sending the PIN. In this case, just send the command, don't fully initialize the port with the initialization sequence. --- src/mm-base-modem-at.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/mm-base-modem-at.c b/src/mm-base-modem-at.c index 2dc32681..e25bdf33 100644 --- a/src/mm-base-modem-at.c +++ b/src/mm-base-modem-at.c @@ -28,6 +28,7 @@ abort_async_if_port_unusable (MMBaseModem *self, gpointer user_data) { GError *error = NULL; + gboolean init_sequence_enabled = FALSE; /* If no port given, probably the port dissapeared */ if (!port) { @@ -53,6 +54,11 @@ abort_async_if_port_unusable (MMBaseModem *self, return FALSE; } + /* Temporarily disable init sequence if we're just sending a + * command to a just opened port */ + g_object_get (port, MM_AT_SERIAL_PORT_INIT_SEQUENCE_ENABLED, &init_sequence_enabled, NULL); + g_object_set (port, MM_AT_SERIAL_PORT_INIT_SEQUENCE_ENABLED, FALSE, NULL); + /* Ensure we have a port open during the sequence */ if (!mm_serial_port_open (MM_SERIAL_PORT (port), &error)) { g_simple_async_report_error_in_idle ( @@ -67,6 +73,9 @@ abort_async_if_port_unusable (MMBaseModem *self, return FALSE; } + /* Reset previous init sequence state */ + g_object_set (port, MM_AT_SERIAL_PORT_INIT_SEQUENCE_ENABLED, init_sequence_enabled, NULL); + return TRUE; } -- cgit v1.2.3-70-g09d2