port-qmi: allow specifying input subsystem

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

This may no longer be true, so allow creating QMI ports with
an explicit subsystem instead of defaulting always to USBMISC.
This commit is contained in:
Aleksander Morgado
2020-11-09 18:41:57 +01:00
parent 7faa3a5e25
commit 799c4c72ce
4 changed files with 23 additions and 21 deletions
+1 -1
View File
@@ -226,7 +226,7 @@ base_modem_create_usbmisc_port (MMBaseModem *self,
{
#if defined WITH_QMI
if (ptype == MM_PORT_TYPE_QMI)
return MM_PORT (mm_port_qmi_new (name));
return MM_PORT (mm_port_qmi_new (name, MM_PORT_SUBSYS_USBMISC));
#endif
#if defined WITH_MBIM
if (ptype == MM_PORT_TYPE_MBIM)
+2 -1
View File
@@ -494,7 +494,8 @@ wdm_probe_qmi (MMPortProbe *self)
mm_obj_dbg (self, "probing QMI...");
/* Create a port and try to open it */
ctx->port_qmi = mm_port_qmi_new (mm_kernel_device_get_name (self->priv->port));
ctx->port_qmi = mm_port_qmi_new (mm_kernel_device_get_name (self->priv->port),
MM_PORT_SUBSYS_USBMISC);
mm_port_qmi_open (ctx->port_qmi,
FALSE,
NULL,
+3 -2
View File
@@ -788,11 +788,12 @@ mm_port_qmi_close (MMPortQmi *self,
/*****************************************************************************/
MMPortQmi *
mm_port_qmi_new (const gchar *name)
mm_port_qmi_new (const gchar *name,
MMPortSubsys subsys)
{
return MM_PORT_QMI (g_object_new (MM_TYPE_PORT_QMI,
MM_PORT_DEVICE, name,
MM_PORT_SUBSYS, MM_PORT_SUBSYS_USBMISC,
MM_PORT_SUBSYS, subsys,
MM_PORT_TYPE, MM_PORT_TYPE_QMI,
NULL));
}
+17 -17
View File
@@ -47,23 +47,23 @@ struct _MMPortQmiClass {
GType mm_port_qmi_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMPortQmi, g_object_unref)
MMPortQmi *mm_port_qmi_new (const gchar *name);
void mm_port_qmi_open (MMPortQmi *self,
gboolean set_data_format,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_port_qmi_open_finish (MMPortQmi *self,
GAsyncResult *res,
GError **error);
gboolean mm_port_qmi_is_open (MMPortQmi *self);
void mm_port_qmi_close (MMPortQmi *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_port_qmi_close_finish (MMPortQmi *self,
GAsyncResult *res,
GError **error);
MMPortQmi *mm_port_qmi_new (const gchar *name,
MMPortSubsys subsys);
void mm_port_qmi_open (MMPortQmi *self,
gboolean set_data_format,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_port_qmi_open_finish (MMPortQmi *self,
GAsyncResult *res,
GError **error);
gboolean mm_port_qmi_is_open (MMPortQmi *self);
void mm_port_qmi_close (MMPortQmi *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_port_qmi_close_finish (MMPortQmi *self,
GAsyncResult *res,
GError **error);
typedef enum {
MM_PORT_QMI_FLAG_DEFAULT = 0,