From 024485e321e1b8de2695a857f32dd37ae2192042 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 27 Mar 2023 12:48:51 +0200 Subject: [PATCH] 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. --- src/mm-port-probe.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/mm-port-probe.c b/src/mm-port-probe.c index 87551c15..e3298ed8 100644 --- a/src/mm-port-probe.c +++ b/src/mm-port-probe.c @@ -758,11 +758,19 @@ serial_probe_qcdm (MMPortProbe *self) if (port_probe_task_return_error_if_cancelled (self)) 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) { mm_obj_dbg (self, "Maybe a QCDM port, but plugin does not require probing and grabbing..."); - mm_port_probe_set_result_qcdm (self, TRUE); - self->priv->is_ignored = TRUE; + /* 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); + self->priv->is_ignored = TRUE; + } else + mm_port_probe_set_result_qcdm (self, FALSE); /* Reschedule probing */ serial_probe_schedule (self); return G_SOURCE_REMOVE;