plugin: allow plugins to require MBIM probing of cdc-wdm ports
This commit is contained in:
@@ -22,6 +22,10 @@ if WITH_QMI
|
||||
PLUGIN_COMMON_COMPILER_FLAGS += $(QMI_CFLAGS)
|
||||
endif
|
||||
|
||||
if WITH_MBIM
|
||||
PLUGIN_COMMON_COMPILER_FLAGS += $(MBIM_CFLAGS)
|
||||
endif
|
||||
|
||||
# UDev rules
|
||||
udevrulesdir = $(UDEV_BASE_DIR)/rules.d
|
||||
udevrules_DATA =
|
||||
|
@@ -77,6 +77,7 @@ struct _MMPluginPrivate {
|
||||
gboolean single_at;
|
||||
gboolean qcdm;
|
||||
gboolean qmi;
|
||||
gboolean mbim;
|
||||
gboolean icera_probe;
|
||||
MMPortProbeAtCommand *custom_at_probe;
|
||||
guint64 send_delay;
|
||||
@@ -106,6 +107,7 @@ enum {
|
||||
PROP_ALLOWED_SINGLE_AT,
|
||||
PROP_ALLOWED_QCDM,
|
||||
PROP_ALLOWED_QMI,
|
||||
PROP_ALLOWED_MBIM,
|
||||
PROP_ICERA_PROBE,
|
||||
PROP_ALLOWED_ICERA,
|
||||
PROP_FORBIDDEN_ICERA,
|
||||
@@ -707,11 +709,15 @@ mm_plugin_supports_port (MMPlugin *self,
|
||||
probe_run_flags |= (MM_PORT_PROBE_AT | MM_PORT_PROBE_AT_ICERA);
|
||||
} else {
|
||||
/* cdc-wdm ports... */
|
||||
probe_run_flags = self->priv->qmi ? MM_PORT_PROBE_QMI : MM_PORT_PROBE_NONE;
|
||||
probe_run_flags = MM_PORT_PROBE_NONE;
|
||||
if (self->priv->qmi)
|
||||
probe_run_flags |= MM_PORT_PROBE_QMI;
|
||||
if (self->priv->mbim)
|
||||
probe_run_flags |= MM_PORT_PROBE_MBIM;
|
||||
}
|
||||
|
||||
/* If no explicit probing was required, just request to grab it without probing anything.
|
||||
* This may happen, e.g. with cdc-wdm ports which do not need QMI probing. */
|
||||
* This may happen, e.g. with cdc-wdm ports which do not need QMI/MBIM probing. */
|
||||
if (probe_run_flags == MM_PORT_PROBE_NONE) {
|
||||
g_simple_async_result_set_op_res_gpointer (async_result,
|
||||
GUINT_TO_POINTER (MM_PLUGIN_SUPPORTS_PORT_DEFER_UNTIL_SUGGESTED),
|
||||
@@ -849,6 +855,16 @@ mm_plugin_create_modem (MMPlugin *self,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"ignoring QMI net port");
|
||||
}
|
||||
#endif
|
||||
#if !defined WITH_MBIM
|
||||
else if (mm_port_probe_get_port_type (probe) == MM_PORT_TYPE_NET &&
|
||||
g_str_equal (mm_device_utils_get_port_driver (mm_port_probe_peek_port (probe)),
|
||||
"cdc_mbim")) {
|
||||
grabbed = FALSE;
|
||||
inner_error = g_error_new (MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"ignoring MBIM net port");
|
||||
}
|
||||
#endif
|
||||
else if (MM_PLUGIN_GET_CLASS (self)->grab_port)
|
||||
grabbed = MM_PLUGIN_GET_CLASS (self)->grab_port (MM_PLUGIN (self),
|
||||
@@ -963,6 +979,10 @@ set_property (GObject *object,
|
||||
/* Construct only */
|
||||
self->priv->qmi = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_ALLOWED_MBIM:
|
||||
/* Construct only */
|
||||
self->priv->mbim = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_ICERA_PROBE:
|
||||
/* Construct only */
|
||||
self->priv->icera_probe = g_value_get_boolean (value);
|
||||
@@ -1052,6 +1072,9 @@ get_property (GObject *object,
|
||||
case PROP_ALLOWED_QMI:
|
||||
g_value_set_boolean (value, self->priv->qmi);
|
||||
break;
|
||||
case PROP_ALLOWED_MBIM:
|
||||
g_value_set_boolean (value, self->priv->mbim);
|
||||
break;
|
||||
case PROP_ALLOWED_UDEV_TAGS:
|
||||
g_value_set_boxed (value, self->priv->udev_tags);
|
||||
break;
|
||||
@@ -1254,6 +1277,14 @@ mm_plugin_class_init (MMPluginClass *klass)
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_ALLOWED_MBIM,
|
||||
g_param_spec_boolean (MM_PLUGIN_ALLOWED_MBIM,
|
||||
"Allowed MBIM",
|
||||
"Whether MBIM ports are allowed in this plugin",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_ICERA_PROBE,
|
||||
g_param_spec_boolean (MM_PLUGIN_ICERA_PROBE,
|
||||
|
@@ -53,6 +53,7 @@
|
||||
#define MM_PLUGIN_ALLOWED_SINGLE_AT "allowed-single-at"
|
||||
#define MM_PLUGIN_ALLOWED_QCDM "allowed-qcdm"
|
||||
#define MM_PLUGIN_ALLOWED_QMI "allowed-qmi"
|
||||
#define MM_PLUGIN_ALLOWED_MBIM "allowed-mbim"
|
||||
#define MM_PLUGIN_ICERA_PROBE "icera-probe"
|
||||
#define MM_PLUGIN_ALLOWED_ICERA "allowed-icera"
|
||||
#define MM_PLUGIN_FORBIDDEN_ICERA "forbidden-icera"
|
||||
|
Reference in New Issue
Block a user