broadband-modem-mbim: allow subclassing the match of control vs net ports

By default we provide the implementation for the cdc_mbim driver,
where both control and net ports share the same USB interface.
This commit is contained in:
Aleksander Morgado
2020-11-09 18:41:57 +01:00
parent 6defec2fae
commit 85d549ef00
2 changed files with 32 additions and 4 deletions
+28 -4
View File
@@ -254,19 +254,31 @@ mm_broadband_modem_mbim_get_port_mbim_for_data (MMBroadbandModemMbim *self,
NULL);
}
MMPortMbim *
mm_broadband_modem_mbim_peek_port_mbim_for_data (MMBroadbandModemMbim *self,
MMPort *data,
GError **error)
static MMPortMbim *
peek_port_mbim_for_data (MMBroadbandModemMbim *self,
MMPort *data,
GError **error)
{
GList *cdc_wdm_mbim_ports;
GList *l;
const gchar *net_port_parent_path;
MMPortMbim *found = NULL;
const gchar *net_port_driver;
g_assert (MM_IS_BROADBAND_MODEM_MBIM (self));
g_assert (mm_port_get_subsys (data) == MM_PORT_SUBSYS_NET);
net_port_driver = mm_kernel_device_get_driver (mm_port_peek_kernel_device (data));
if (g_strcmp0 (net_port_driver, "cdc_mbim") != 0) {
g_set_error (error,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
"Unsupported MBIM kernel driver for 'net/%s': %s",
mm_port_get_device (data),
net_port_driver);
return NULL;
}
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,
@@ -304,6 +316,16 @@ mm_broadband_modem_mbim_peek_port_mbim_for_data (MMBroadbandModemMbim *self,
return found;
}
MMPortMbim *
mm_broadband_modem_mbim_peek_port_mbim_for_data (MMBroadbandModemMbim *self,
MMPort *data,
GError **error)
{
g_assert (MM_BROADBAND_MODEM_MBIM_GET_CLASS (self)->peek_port_mbim_for_data);
return MM_BROADBAND_MODEM_MBIM_GET_CLASS (self)->peek_port_mbim_for_data (self, data, error);
}
/*****************************************************************************/
/* Current capabilities (Modem interface) */
@@ -5811,6 +5833,8 @@ mm_broadband_modem_mbim_class_init (MMBroadbandModemMbimClass *klass)
g_type_class_add_private (object_class, sizeof (MMBroadbandModemMbimPrivate));
klass->peek_port_mbim_for_data = peek_port_mbim_for_data;
object_class->dispose = dispose;
object_class->finalize = finalize;
+4
View File
@@ -36,6 +36,10 @@ struct _MMBroadbandModemMbim {
struct _MMBroadbandModemMbimClass{
MMBroadbandModemClass parent;
MMPortMbim * (* peek_port_mbim_for_data) (MMBroadbandModemMbim *self,
MMPort *data,
GError **error);
};
GType mm_broadband_modem_mbim_get_type (void);