port-probe: create port-qmi using a QRTR node

For QRTR devices, create the qmi ports using the QRTR node.
This commit is contained in:
Andrew Lassalle
2020-11-25 14:42:57 -08:00
committed by Aleksander Morgado
parent aeed8c9e5b
commit 5f1bac5cf8

View File

@@ -42,6 +42,10 @@
#include "mm-port-qmi.h"
#endif
#if defined WITH_QRTR
#include "mm-kernel-device-qrtr.h"
#endif
#if defined WITH_MBIM
#include "mm-port-mbim.h"
#endif
@@ -491,22 +495,33 @@ wdm_probe_qmi (MMPortProbe *self)
ctx = g_task_get_task_data (self->priv->task);
#if defined WITH_QMI
/* Create a port and try to open it */
mm_obj_dbg (self, "probing QMI...");
#if defined WITH_QRTR
if (MM_IS_KERNEL_DEVICE_QRTR (self->priv->port)) {
g_autoptr(QrtrNode) node = NULL;
node = mm_kernel_device_qrtr_get_node (MM_KERNEL_DEVICE_QRTR (self->priv->port));
/* Will set MM_PORT_SUBSYS_QRTR when creating the mm-port */
ctx->port_qmi = mm_port_qmi_new_from_node (mm_kernel_device_get_name (self->priv->port), node);
} else
#endif /* WITH_QRTR */
{
MMPortSubsys subsys = MM_PORT_SUBSYS_USBMISC;
mm_obj_dbg (self, "probing QMI...");
if (g_str_equal (mm_kernel_device_get_subsystem (self->priv->port), "rpmsg"))
subsys = MM_PORT_SUBSYS_RPMSG;
/* Create a port and try to open it */
ctx->port_qmi = mm_port_qmi_new (mm_kernel_device_get_name (self->priv->port), subsys);
}
mm_port_qmi_open (ctx->port_qmi,
FALSE,
NULL,
(GAsyncReadyCallback) port_qmi_open_ready,
self);
}
#else
/* If not compiled with QMI support, just assume we won't have any QMI port */
mm_port_probe_set_result_qmi (self, FALSE);