port-mbim: allow specifying input subsystem

We have assumed until now that all MBIM ports are based on the
cdc_mbim driver, exposed in the 'usbmisc' subsystem by the cdc-wdm
driver.

This may no longer be true, so allow creating MBIM ports with
an explicit subsystem instead of defaulting always to USBMISC.
This commit is contained in:
Aleksander Morgado
2020-10-25 14:05:50 +01:00
parent 4ec2db75b8
commit 7faa3a5e25
4 changed files with 8 additions and 5 deletions

View File

@@ -230,7 +230,7 @@ base_modem_create_usbmisc_port (MMBaseModem *self,
#endif #endif
#if defined WITH_MBIM #if defined WITH_MBIM
if (ptype == MM_PORT_TYPE_MBIM) if (ptype == MM_PORT_TYPE_MBIM)
return MM_PORT (mm_port_mbim_new (name)); return MM_PORT (mm_port_mbim_new (name, MM_PORT_SUBSYS_USBMISC));
#endif #endif
if (ptype == MM_PORT_TYPE_AT) if (ptype == MM_PORT_TYPE_AT)
return MM_PORT (mm_port_serial_at_new (name, MM_PORT_SUBSYS_USBMISC)); return MM_PORT (mm_port_serial_at_new (name, MM_PORT_SUBSYS_USBMISC));

View File

@@ -589,11 +589,12 @@ mm_port_mbim_peek_device (MMPortMbim *self)
/*****************************************************************************/ /*****************************************************************************/
MMPortMbim * MMPortMbim *
mm_port_mbim_new (const gchar *name) mm_port_mbim_new (const gchar *name,
MMPortSubsys subsys)
{ {
return MM_PORT_MBIM (g_object_new (MM_TYPE_PORT_MBIM, return MM_PORT_MBIM (g_object_new (MM_TYPE_PORT_MBIM,
MM_PORT_DEVICE, name, MM_PORT_DEVICE, name,
MM_PORT_SUBSYS, MM_PORT_SUBSYS_USBMISC, MM_PORT_SUBSYS, subsys,
MM_PORT_TYPE, MM_PORT_TYPE_MBIM, MM_PORT_TYPE, MM_PORT_TYPE_MBIM,
NULL)); NULL));
} }

View File

@@ -53,7 +53,8 @@ struct _MMPortMbimClass {
GType mm_port_mbim_get_type (void); GType mm_port_mbim_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMPortMbim, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMPortMbim, g_object_unref)
MMPortMbim *mm_port_mbim_new (const gchar *name); MMPortMbim *mm_port_mbim_new (const gchar *name,
MMPortSubsys subsys);
void mm_port_mbim_open (MMPortMbim *self, void mm_port_mbim_open (MMPortMbim *self,
#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED #if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED

View File

@@ -566,7 +566,8 @@ wdm_probe_mbim (MMPortProbe *self)
mm_obj_dbg (self, "probing MBIM..."); mm_obj_dbg (self, "probing MBIM...");
/* Create a port and try to open it */ /* Create a port and try to open it */
ctx->mbim_port = mm_port_mbim_new (mm_kernel_device_get_name (self->priv->port)); ctx->mbim_port = mm_port_mbim_new (mm_kernel_device_get_name (self->priv->port),
MM_PORT_SUBSYS_USBMISC);
mm_port_mbim_open (ctx->mbim_port, mm_port_mbim_open (ctx->mbim_port,
#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED #if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
FALSE, /* Don't check QMI over MBIM support at this stage */ FALSE, /* Don't check QMI over MBIM support at this stage */