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.
This commit is contained in:
@@ -28,6 +28,7 @@ abort_async_if_port_unusable (MMBaseModem *self,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
gboolean init_sequence_enabled = FALSE;
|
||||||
|
|
||||||
/* If no port given, probably the port dissapeared */
|
/* If no port given, probably the port dissapeared */
|
||||||
if (!port) {
|
if (!port) {
|
||||||
@@ -53,6 +54,11 @@ abort_async_if_port_unusable (MMBaseModem *self,
|
|||||||
return FALSE;
|
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 */
|
/* Ensure we have a port open during the sequence */
|
||||||
if (!mm_serial_port_open (MM_SERIAL_PORT (port), &error)) {
|
if (!mm_serial_port_open (MM_SERIAL_PORT (port), &error)) {
|
||||||
g_simple_async_report_error_in_idle (
|
g_simple_async_report_error_in_idle (
|
||||||
@@ -67,6 +73,9 @@ abort_async_if_port_unusable (MMBaseModem *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Reset previous init sequence state */
|
||||||
|
g_object_set (port, MM_AT_SERIAL_PORT_INIT_SEQUENCE_ENABLED, init_sequence_enabled, NULL);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user