port-probe: don't assume port is QCDM when QCDM is not required

When QCDM is not required we don't run an explicit QCDM port probing
operation.

In this case, though, we should not assume that the port is QCDM
capable, even if it is also flagged as ignored.

Instead, we'll flag the port as QCDM capable and ignored only if there
was a udev port type hint associated to the port. Otherwise, we'll
report the port as not being QCDM capable, and the port won't even be
reported in the list of ports as its type is unknown.
This commit is contained in:
Aleksander Morgado
2023-03-27 12:48:51 +02:00
committed by Aleksander Morgado
parent 7787c34af0
commit 024485e321

View File

@@ -758,11 +758,19 @@ serial_probe_qcdm (MMPortProbe *self)
if (port_probe_task_return_error_if_cancelled (self)) if (port_probe_task_return_error_if_cancelled (self))
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
/* Check if port requires QCDM probing */ /* If the plugin specifies QCDM is not required, we can right away complete the QCDM
* probing task. */
if (!ctx->qcdm_required) { if (!ctx->qcdm_required) {
mm_obj_dbg (self, "Maybe a QCDM port, but plugin does not require probing and grabbing..."); mm_obj_dbg (self, "Maybe a QCDM port, but plugin does not require probing and grabbing...");
/* If we had a port type hint, flag the port as QCDM capable but ignored. Otherwise,
* no QCDM capable and not ignored. The outcome is really the same, i.e. the port is not
* used any more, but the way it's reported in DBus will be different (i.e. "ignored" vs
"unknown" */
if (self->priv->maybe_qcdm) {
mm_port_probe_set_result_qcdm (self, TRUE); mm_port_probe_set_result_qcdm (self, TRUE);
self->priv->is_ignored = TRUE; self->priv->is_ignored = TRUE;
} else
mm_port_probe_set_result_qcdm (self, FALSE);
/* Reschedule probing */ /* Reschedule probing */
serial_probe_schedule (self); serial_probe_schedule (self);
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;