port-probe: avoid QCDM port probing if not for specific plugins
The QCDM/DIAG port is usually nowadays exclusively used by applications gathering traces from the modem, so avoid port probing and grabbing when plugins set the property MM_PLUGIN_ALLOWED_QCDM. A new property MM_PLUGIN_REQUIRED_QCDM is created for those plugins requiring the QCDM port for properly using a modem.
This commit is contained in:

committed by
Aleksander Morgado

parent
661a63b37b
commit
d6203265c2
@@ -91,6 +91,7 @@ struct _MMPluginPrivate {
|
|||||||
gboolean at;
|
gboolean at;
|
||||||
gboolean single_at;
|
gboolean single_at;
|
||||||
gboolean qcdm;
|
gboolean qcdm;
|
||||||
|
gboolean qcdm_required;
|
||||||
gboolean qmi;
|
gboolean qmi;
|
||||||
gboolean mbim;
|
gboolean mbim;
|
||||||
gboolean icera_probe;
|
gboolean icera_probe;
|
||||||
@@ -124,6 +125,7 @@ enum {
|
|||||||
PROP_ALLOWED_AT,
|
PROP_ALLOWED_AT,
|
||||||
PROP_ALLOWED_SINGLE_AT,
|
PROP_ALLOWED_SINGLE_AT,
|
||||||
PROP_ALLOWED_QCDM,
|
PROP_ALLOWED_QCDM,
|
||||||
|
PROP_REQUIRED_QCDM,
|
||||||
PROP_ALLOWED_QMI,
|
PROP_ALLOWED_QMI,
|
||||||
PROP_ALLOWED_MBIM,
|
PROP_ALLOWED_MBIM,
|
||||||
PROP_ICERA_PROBE,
|
PROP_ICERA_PROBE,
|
||||||
@@ -802,7 +804,7 @@ mm_plugin_supports_port (MMPlugin *self,
|
|||||||
probe_run_flags |= MM_PORT_PROBE_AT;
|
probe_run_flags |= MM_PORT_PROBE_AT;
|
||||||
else if (self->priv->single_at)
|
else if (self->priv->single_at)
|
||||||
probe_run_flags |= MM_PORT_PROBE_AT;
|
probe_run_flags |= MM_PORT_PROBE_AT;
|
||||||
if (self->priv->qcdm)
|
if (self->priv->qcdm || self->priv->qcdm_required)
|
||||||
probe_run_flags |= MM_PORT_PROBE_QCDM;
|
probe_run_flags |= MM_PORT_PROBE_QCDM;
|
||||||
} else if (g_str_equal (mm_kernel_device_get_subsystem (port), "usbmisc")) {
|
} else if (g_str_equal (mm_kernel_device_get_subsystem (port), "usbmisc")) {
|
||||||
if (self->priv->qmi && !g_strcmp0 (mm_kernel_device_get_driver (port), "qmi_wwan"))
|
if (self->priv->qmi && !g_strcmp0 (mm_kernel_device_get_driver (port), "qmi_wwan"))
|
||||||
@@ -821,7 +823,7 @@ mm_plugin_supports_port (MMPlugin *self,
|
|||||||
probe_run_flags |= MM_PORT_PROBE_MBIM;
|
probe_run_flags |= MM_PORT_PROBE_MBIM;
|
||||||
if (self->priv->qmi)
|
if (self->priv->qmi)
|
||||||
probe_run_flags |= MM_PORT_PROBE_QMI;
|
probe_run_flags |= MM_PORT_PROBE_QMI;
|
||||||
if (self->priv->qcdm)
|
if (self->priv->qcdm || self->priv->qcdm_required)
|
||||||
probe_run_flags |= MM_PORT_PROBE_QCDM;
|
probe_run_flags |= MM_PORT_PROBE_QCDM;
|
||||||
if (self->priv->at)
|
if (self->priv->at)
|
||||||
probe_run_flags |= MM_PORT_PROBE_AT;
|
probe_run_flags |= MM_PORT_PROBE_AT;
|
||||||
@@ -893,6 +895,7 @@ mm_plugin_supports_port (MMPlugin *self,
|
|||||||
self->priv->send_lf,
|
self->priv->send_lf,
|
||||||
self->priv->custom_at_probe,
|
self->priv->custom_at_probe,
|
||||||
self->priv->custom_init,
|
self->priv->custom_init,
|
||||||
|
self->priv->qcdm_required,
|
||||||
cancellable,
|
cancellable,
|
||||||
(GAsyncReadyCallback) port_probe_run_ready,
|
(GAsyncReadyCallback) port_probe_run_ready,
|
||||||
task);
|
task);
|
||||||
@@ -1238,6 +1241,10 @@ set_property (GObject *object,
|
|||||||
/* Construct only */
|
/* Construct only */
|
||||||
self->priv->qcdm = g_value_get_boolean (value);
|
self->priv->qcdm = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_REQUIRED_QCDM:
|
||||||
|
/* Construct only */
|
||||||
|
self->priv->qcdm_required = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
case PROP_ALLOWED_QMI:
|
case PROP_ALLOWED_QMI:
|
||||||
/* Construct only */
|
/* Construct only */
|
||||||
self->priv->qmi = g_value_get_boolean (value);
|
self->priv->qmi = g_value_get_boolean (value);
|
||||||
@@ -1350,6 +1357,9 @@ get_property (GObject *object,
|
|||||||
case PROP_ALLOWED_QCDM:
|
case PROP_ALLOWED_QCDM:
|
||||||
g_value_set_boolean (value, self->priv->qcdm);
|
g_value_set_boolean (value, self->priv->qcdm);
|
||||||
break;
|
break;
|
||||||
|
case PROP_REQUIRED_QCDM:
|
||||||
|
g_value_set_boolean (value, self->priv->qcdm_required);
|
||||||
|
break;
|
||||||
case PROP_ALLOWED_QMI:
|
case PROP_ALLOWED_QMI:
|
||||||
g_value_set_boolean (value, self->priv->qmi);
|
g_value_set_boolean (value, self->priv->qmi);
|
||||||
break;
|
break;
|
||||||
@@ -1583,6 +1593,14 @@ mm_plugin_class_init (MMPluginClass *klass)
|
|||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
|
g_object_class_install_property
|
||||||
|
(object_class, PROP_REQUIRED_QCDM,
|
||||||
|
g_param_spec_boolean (MM_PLUGIN_REQUIRED_QCDM,
|
||||||
|
"Required QCDM",
|
||||||
|
"Whether QCDM ports are required in this plugin",
|
||||||
|
FALSE,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_ALLOWED_QMI,
|
(object_class, PROP_ALLOWED_QMI,
|
||||||
g_param_spec_boolean (MM_PLUGIN_ALLOWED_QMI,
|
g_param_spec_boolean (MM_PLUGIN_ALLOWED_QMI,
|
||||||
|
@@ -62,6 +62,7 @@
|
|||||||
#define MM_PLUGIN_ALLOWED_AT "allowed-at"
|
#define MM_PLUGIN_ALLOWED_AT "allowed-at"
|
||||||
#define MM_PLUGIN_ALLOWED_SINGLE_AT "allowed-single-at"
|
#define MM_PLUGIN_ALLOWED_SINGLE_AT "allowed-single-at"
|
||||||
#define MM_PLUGIN_ALLOWED_QCDM "allowed-qcdm"
|
#define MM_PLUGIN_ALLOWED_QCDM "allowed-qcdm"
|
||||||
|
#define MM_PLUGIN_REQUIRED_QCDM "required-qcdm"
|
||||||
#define MM_PLUGIN_ALLOWED_QMI "allowed-qmi"
|
#define MM_PLUGIN_ALLOWED_QMI "allowed-qmi"
|
||||||
#define MM_PLUGIN_ALLOWED_MBIM "allowed-mbim"
|
#define MM_PLUGIN_ALLOWED_MBIM "allowed-mbim"
|
||||||
#define MM_PLUGIN_ICERA_PROBE "icera-probe"
|
#define MM_PLUGIN_ICERA_PROBE "icera-probe"
|
||||||
|
@@ -380,6 +380,9 @@ typedef struct {
|
|||||||
/* ---- MBIM probing specific context ---- */
|
/* ---- MBIM probing specific context ---- */
|
||||||
MMPortMbim *mbim_port;
|
MMPortMbim *mbim_port;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* ---- QCDM probing specific context ---- */
|
||||||
|
gboolean qcdm_required;
|
||||||
} PortProbeRunContext;
|
} PortProbeRunContext;
|
||||||
|
|
||||||
static gboolean serial_probe_at (MMPortProbe *self);
|
static gboolean serial_probe_at (MMPortProbe *self);
|
||||||
@@ -756,6 +759,17 @@ serial_probe_qcdm (MMPortProbe *self)
|
|||||||
if (port_probe_task_return_error_if_cancelled (self))
|
if (port_probe_task_return_error_if_cancelled (self))
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
|
|
||||||
|
/* Check if port requires QCDM probing */
|
||||||
|
if (!ctx->qcdm_required) {
|
||||||
|
/* Ok, this is probably a QCDM port */
|
||||||
|
mm_obj_dbg (self, "Likely a QCDM port, but plugin does not require probing and grabbing...");
|
||||||
|
mm_port_probe_set_result_qcdm (self, TRUE);
|
||||||
|
self->priv->is_ignored = TRUE;
|
||||||
|
/* Reschedule probing */
|
||||||
|
serial_probe_schedule (self);
|
||||||
|
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
} else {
|
||||||
mm_obj_dbg (self, "probing QCDM...");
|
mm_obj_dbg (self, "probing QCDM...");
|
||||||
|
|
||||||
/* If open, close the AT port */
|
/* If open, close the AT port */
|
||||||
@@ -835,6 +849,7 @@ serial_probe_qcdm (MMPortProbe *self)
|
|||||||
|
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* AT */
|
/* AT */
|
||||||
@@ -1428,6 +1443,7 @@ mm_port_probe_run (MMPortProbe *self,
|
|||||||
gboolean at_send_lf,
|
gboolean at_send_lf,
|
||||||
const MMPortProbeAtCommand *at_custom_probe,
|
const MMPortProbeAtCommand *at_custom_probe,
|
||||||
const MMAsyncMethod *at_custom_init,
|
const MMAsyncMethod *at_custom_init,
|
||||||
|
gboolean qcdm_required,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@@ -1453,6 +1469,7 @@ mm_port_probe_run (MMPortProbe *self,
|
|||||||
ctx->at_custom_probe = at_custom_probe;
|
ctx->at_custom_probe = at_custom_probe;
|
||||||
ctx->at_custom_init = at_custom_init ? (MMPortProbeAtCustomInit)at_custom_init->async : NULL;
|
ctx->at_custom_init = at_custom_init ? (MMPortProbeAtCustomInit)at_custom_init->async : NULL;
|
||||||
ctx->at_custom_init_finish = at_custom_init ? (MMPortProbeAtCustomInitFinish)at_custom_init->finish : NULL;
|
ctx->at_custom_init_finish = at_custom_init ? (MMPortProbeAtCustomInitFinish)at_custom_init->finish : NULL;
|
||||||
|
ctx->qcdm_required = qcdm_required;
|
||||||
ctx->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
ctx->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||||
|
|
||||||
/* The context will be owned by the task */
|
/* The context will be owned by the task */
|
||||||
|
@@ -117,6 +117,7 @@ void mm_port_probe_run (MMPortProbe *self,
|
|||||||
gboolean at_send_lf,
|
gboolean at_send_lf,
|
||||||
const MMPortProbeAtCommand *at_custom_probe,
|
const MMPortProbeAtCommand *at_custom_probe,
|
||||||
const MMAsyncMethod *at_custom_init,
|
const MMAsyncMethod *at_custom_init,
|
||||||
|
gboolean qcdm_required,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
Reference in New Issue
Block a user