port-probe: don't reschedule next probing step when serial port buffer full
When the serial port buffer gets full of non-AT garbage during port probing, we were re-scheduling the next probing step, which is completely wrong, as we then would be processing the same probing task twice. If we get a buffer full, just cancel the AT probing cancellable, which would cancel not only the possible AT probings, but also the custom init if there is any. Also, make sure that the custom_init() of the plugins out there don't return an error if the GCancellable is cancelled. Cancelling the GCancellable means we should just stop the custom_init(), and actually sending an error in custom_init() means that the port should be set as unsupported by the plugin, so completely different things. Should fix https://bugzilla.gnome.org/show_bug.cgi?id=696695
This commit is contained in:
@@ -235,10 +235,7 @@ huawei_custom_init_step (HuaweiCustomInitContext *ctx)
|
||||
if (g_cancellable_is_cancelled (ctx->cancellable)) {
|
||||
mm_dbg ("(Huawei) no need to keep on running custom init in (%s)",
|
||||
mm_port_get_device (MM_PORT (ctx->port)));
|
||||
g_simple_async_result_set_error (ctx->result,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_CANCELLED,
|
||||
"Custom initialization cancelled");
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
huawei_custom_init_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
@@ -107,10 +107,7 @@ longcheer_custom_init_step (LongcheerCustomInitContext *ctx)
|
||||
if (g_cancellable_is_cancelled (ctx->cancellable)) {
|
||||
mm_dbg ("(Longcheer) no need to keep on running custom init in (%s)",
|
||||
mm_port_get_device (MM_PORT (ctx->port)));
|
||||
g_simple_async_result_set_error (ctx->result,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_CANCELLED,
|
||||
"Custom initialization cancelled");
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
longcheer_custom_init_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
@@ -126,18 +126,16 @@ sierra_custom_init_step (SierraCustomInitContext *ctx)
|
||||
{
|
||||
/* If cancelled, end */
|
||||
if (g_cancellable_is_cancelled (ctx->cancellable)) {
|
||||
mm_dbg ("(Sierra) no need to keep on running custom init in (%s)",
|
||||
mm_dbg ("(Sierra) no need to keep on running custom init in '%s'",
|
||||
mm_port_get_device (MM_PORT (ctx->port)));
|
||||
g_simple_async_result_set_error (ctx->result,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_CANCELLED,
|
||||
"Custom initialization cancelled");
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
sierra_custom_init_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->retries == 0) {
|
||||
mm_dbg ("(Sierra) Couldn't get port type hints");
|
||||
mm_dbg ("(Sierra) Couldn't get port type hints from '%s'",
|
||||
mm_port_get_device (MM_PORT (ctx->port)));
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
sierra_custom_init_context_complete_and_free (ctx);
|
||||
return;
|
||||
|
@@ -106,10 +106,7 @@ x22x_custom_init_step (X22xCustomInitContext *ctx)
|
||||
if (g_cancellable_is_cancelled (ctx->cancellable)) {
|
||||
mm_dbg ("(X22X) no need to keep on running custom init in (%s)",
|
||||
mm_port_get_device (MM_PORT (ctx->port)));
|
||||
g_simple_async_result_set_error (ctx->result,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_CANCELLED,
|
||||
"Custom initialization cancelled");
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
x22x_custom_init_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
@@ -940,10 +940,16 @@ serial_buffer_full (MMSerialPort *serial,
|
||||
GByteArray *buffer,
|
||||
MMPortProbe *self)
|
||||
{
|
||||
PortProbeRunTask *task = self->priv->task;
|
||||
|
||||
if (is_non_at_response (buffer->data, buffer->len)) {
|
||||
mm_serial_port_close (serial);
|
||||
mm_dbg ("(%s/%s) serial buffer full",
|
||||
g_udev_device_get_subsystem (self->priv->port),
|
||||
g_udev_device_get_name (self->priv->port));
|
||||
/* Don't explicitly close the AT port, just end the AT probing
|
||||
* (or custom init probing) */
|
||||
mm_port_probe_set_result_at (self, FALSE);
|
||||
serial_probe_schedule (self);
|
||||
g_cancellable_cancel (task->at_probing_cancellable);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user