diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2020-10-22 12:07:09 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2020-11-09 18:41:57 +0100 |
commit | b8f6fb59ed3f9c314c6b13b0830c0930c718902d (patch) | |
tree | b7893b9065628600ca9ed08ad62eca7951e14df6 /src/mm-base-modem.c | |
parent | 0dbb8d03f59d0db8cf6be63020b78289c3168154 (diff) |
broadband-modem-qmi: peeking QMI port only in QMI modems
Move the logic out of the base modem, and make it applicable only for
QMI modems.
Diffstat (limited to 'src/mm-base-modem.c')
-rw-r--r-- | src/mm-base-modem.c | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/src/mm-base-modem.c b/src/mm-base-modem.c index 9343ccba..93221dae 100644 --- a/src/mm-base-modem.c +++ b/src/mm-base-modem.c @@ -681,85 +681,6 @@ mm_base_modem_peek_port_audio (MMBaseModem *self) return self->priv->audio; } -#if defined WITH_QMI - -MMPortQmi * -mm_base_modem_get_port_qmi (MMBaseModem *self) -{ - g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL); - - /* First QMI port in the list is the primary one always */ - return (self->priv->qmi ? ((MMPortQmi *)g_object_ref (self->priv->qmi->data)) : NULL); -} - -MMPortQmi * -mm_base_modem_peek_port_qmi (MMBaseModem *self) -{ - g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL); - - /* First QMI port in the list is the primary one always */ - return (self->priv->qmi ? (MMPortQmi *)self->priv->qmi->data : NULL); -} - -MMPortQmi * -mm_base_modem_get_port_qmi_for_data (MMBaseModem *self, - MMPort *data, - GError **error) -{ - MMPortQmi *qmi; - - qmi = mm_base_modem_peek_port_qmi_for_data (self, data, error); - return (qmi ? (MMPortQmi *)g_object_ref (qmi) : NULL); -} - -MMPortQmi * -mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self, - MMPort *data, - GError **error) -{ - GList *cdc_wdm_qmi_ports, *l; - const gchar *net_port_parent_path; - MMPortQmi *found = NULL; - - g_warn_if_fail (mm_port_get_subsys (data) == MM_PORT_SUBSYS_NET); - net_port_parent_path = mm_kernel_device_get_interface_sysfs_path (mm_port_peek_kernel_device (data)); - if (!net_port_parent_path) { - g_set_error (error, - MM_CORE_ERROR, - MM_CORE_ERROR_FAILED, - "No parent path for 'net/%s'", - mm_port_get_device (data)); - return NULL; - } - - /* Find the CDC-WDM port on the same USB interface as the given net port */ - cdc_wdm_qmi_ports = mm_base_modem_find_ports (MM_BASE_MODEM (self), - MM_PORT_SUBSYS_USB, - MM_PORT_TYPE_QMI, - NULL); - for (l = cdc_wdm_qmi_ports; l && !found; l = g_list_next (l)) { - const gchar *wdm_port_parent_path; - - g_assert (MM_IS_PORT_QMI (l->data)); - wdm_port_parent_path = mm_kernel_device_get_interface_sysfs_path (mm_port_peek_kernel_device (MM_PORT (l->data))); - if (wdm_port_parent_path && g_str_equal (wdm_port_parent_path, net_port_parent_path)) - found = MM_PORT_QMI (l->data); - } - - g_list_free_full (cdc_wdm_qmi_ports, g_object_unref); - - if (!found) - g_set_error (error, - MM_CORE_ERROR, - MM_CORE_ERROR_NOT_FOUND, - "Couldn't find associated QMI port for 'net/%s'", - mm_port_get_device (data)); - - return found; -} - -#endif /* WITH_QMI */ - MMPort * mm_base_modem_get_best_data_port (MMBaseModem *self, MMPortType type) |