diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2020-10-22 11:52:46 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2020-11-09 18:41:57 +0100 |
commit | 6defec2faed9e796584dd9b519ab777f9019d31b (patch) | |
tree | f2dfcff56ad44d347d413e741a995752604c217a /src/mm-base-modem.c | |
parent | ca0dbd07288d67c91e7018819cdd4aa36d57cf2a (diff) |
broadband-modem-mbim: peeking MBIM port only in MBIM modems
Move the logic out of the base modem, and make it applicable only for
MBIM modems.
Diffstat (limited to 'src/mm-base-modem.c')
-rw-r--r-- | src/mm-base-modem.c | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/src/mm-base-modem.c b/src/mm-base-modem.c index 153e0c4d..9343ccba 100644 --- a/src/mm-base-modem.c +++ b/src/mm-base-modem.c @@ -760,86 +760,6 @@ mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self, #endif /* WITH_QMI */ -#if defined WITH_MBIM - -MMPortMbim * -mm_base_modem_get_port_mbim (MMBaseModem *self) -{ - g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL); - - /* First MBIM port in the list is the primary one always */ - return (self->priv->mbim ? ((MMPortMbim *)g_object_ref (self->priv->mbim->data)) : NULL); -} - -MMPortMbim * -mm_base_modem_peek_port_mbim (MMBaseModem *self) -{ - g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL); - - /* First MBIM port in the list is the primary one always */ - return (self->priv->mbim ? (MMPortMbim *)self->priv->mbim->data : NULL); -} - -MMPortMbim * -mm_base_modem_get_port_mbim_for_data (MMBaseModem *self, - MMPort *data, - GError **error) -{ - MMPortMbim *mbim; - - mbim = mm_base_modem_peek_port_mbim_for_data (self, data, error); - return (mbim ? (MMPortMbim *)g_object_ref (mbim) : NULL); -} - -MMPortMbim * -mm_base_modem_peek_port_mbim_for_data (MMBaseModem *self, - MMPort *data, - GError **error) -{ - GList *cdc_wdm_mbim_ports, *l; - const gchar *net_port_parent_path; - MMPortMbim *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_mbim_ports = mm_base_modem_find_ports (MM_BASE_MODEM (self), - MM_PORT_SUBSYS_USB, - MM_PORT_TYPE_MBIM, - NULL); - - for (l = cdc_wdm_mbim_ports; l && !found; l = g_list_next (l)) { - const gchar *wdm_port_parent_path; - - g_assert (MM_IS_PORT_MBIM (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_MBIM (l->data); - } - - g_list_free_full (cdc_wdm_mbim_ports, g_object_unref); - - if (!found) - g_set_error (error, - MM_CORE_ERROR, - MM_CORE_ERROR_NOT_FOUND, - "Couldn't find associated MBIM port for 'net/%s'", - mm_port_get_device (data)); - - return found; -} - -#endif /* WITH_MBIM */ - MMPort * mm_base_modem_get_best_data_port (MMBaseModem *self, MMPortType type) |