diff options
author | Stephan Gerhold <stephan.gerhold@kernkonzept.com> | 2022-08-03 14:28:57 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2022-08-18 09:05:58 +0000 |
commit | 5cc34d5f86bad12382d97e1daea894d8666a527d (patch) | |
tree | ba64f76edd0618e91fbc287746129d9ed5562745 /src/mm-port-qmi.c | |
parent | 598b9ae63960fc5e2483c695212fbce65833a92d (diff) |
port-qmi: Detect endpoint type based on net driver
At the moment the endpoint type and number for the QMI WDA calls are
chosen based on the subsystem of the QMI control port. This does not
work correctly for some configurations:
- SUBSYS_QRTR currently implies ENDPOINT_TYPE_EMBEDDED, but this is
only valid for QRTR+IPA configurations. For QRTR+BAM-DMUX the
correct type is ENDPOINT_TYPE_BAM_DMUX.
- SUBSYS_WWAN currently implies ENDPOINT_TYPE_PCIE, but there is
already a comment that mentions that this selection works only for
MHI/PCIe modems. SUBSYS_WWAN is also used by RPMSG+BAM-DMUX
configurations in which case the correct type is also
ENDPOINT_TYPE_BAM_DMUX.
Looking closer at these cases suggests that the endpoint type actually
refers to the data/net port and not the control port. It is more
reliable choose it based on the network driver and not the subsystem
of the control port.
Address this partially by choosing the endpoint type based on the
net_driver. Choosing the endpoint interface number correctly requires
more refactoring since most of the logic is currently handled globally
for a QMI control port, while it's actually specific to the chosen
data/net port in some cases (e.g. multiple BAM-DMUX network interfaces).
Diffstat (limited to 'src/mm-port-qmi.c')
-rw-r--r-- | src/mm-port-qmi.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/mm-port-qmi.c b/src/mm-port-qmi.c index 0fedd80d..267c8991 100644 --- a/src/mm-port-qmi.c +++ b/src/mm-port-qmi.c @@ -67,7 +67,6 @@ struct _MMPortQmiPrivate { /* timeout monitoring */ gulong timeout_monitoring_id; /* endpoint info */ - gulong endpoint_info_signal_id; QmiDataEndpointType endpoint_type; gint endpoint_interface_number; /* kernel data mode */ @@ -149,10 +148,7 @@ initialize_endpoint_info (MMPortQmi *self) kernel_device = mm_port_peek_kernel_device (MM_PORT (self)); - if (!kernel_device) - self->priv->endpoint_type = QMI_DATA_ENDPOINT_TYPE_UNDEFINED; - else - self->priv->endpoint_type = mm_port_subsys_to_qmi_endpoint_type (mm_port_get_subsys (MM_PORT (self))); + self->priv->endpoint_type = mm_port_net_driver_to_qmi_endpoint_type (self->priv->net_driver); switch (self->priv->endpoint_type) { case QMI_DATA_ENDPOINT_TYPE_HSUSB: @@ -2578,6 +2574,7 @@ mm_port_qmi_set_net_driver (MMPortQmi *self, g_assert (MM_IS_PORT_QMI (self)); g_assert (!self->priv->net_driver); self->priv->net_driver = g_strdup (net_driver); + initialize_endpoint_info (self); } /*****************************************************************************/ @@ -2729,12 +2726,6 @@ static void mm_port_qmi_init (MMPortQmi *self) { self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_PORT_QMI, MMPortQmiPrivate); - - /* load endpoint info as soon as kernel device is set */ - self->priv->endpoint_info_signal_id = g_signal_connect (self, - "notify::" MM_PORT_KERNEL_DEVICE, - G_CALLBACK (initialize_endpoint_info), - NULL); } #if defined WITH_QRTR @@ -2784,11 +2775,6 @@ dispose (GObject *object) MMPortQmi *self = MM_PORT_QMI (object); GList *l; - if (self->priv->endpoint_info_signal_id) { - g_signal_handler_disconnect (self, self->priv->endpoint_info_signal_id); - self->priv->endpoint_info_signal_id = 0; - } - /* Deallocate all clients */ for (l = self->priv->services; l; l = g_list_next (l)) { ServiceInfo *info = l->data; |