diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-02-18 16:06:01 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-02-18 16:06:18 +0100 |
commit | d593116d68ecda7fc0ef67e7399d0588cde60a38 (patch) | |
tree | c28722a0f68383dbb9498d2f9894065d41131d23 | |
parent | 7a58647af78295d059628c73c4dc2558131fea51 (diff) |
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.
-rw-r--r-- | src/mm-base-modem-at.c | 9 |
1 files changed, 9 insertions, 0 deletions
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; } |