plugin-manager: handle race condition during probing
The specific case: * Modem exposes cdc-wdm port, Generic plugin probes it successfully as QMI. * Modem exposes new ports, including the wwan one. All ttys fail probing because they're neither AT nor QCDM (CnS in this case). * The wwan port ends up without a port being suggested and is not grabbed. The root cause of this is that we do not propagate the suggested plugin to newly added ports when it's the Generic one. If it wasn't the Generic one, the newly added ports would start with the suggested one for probing. Now, handle this by looking for the device-specified plugin when the port probing ends without a specific port given. If there is such a device-specified plugin accept the port, and otherwise, reject it.
This commit is contained in:
@@ -142,8 +142,21 @@ static void
|
|||||||
port_probe_context_finished (PortProbeContext *port_probe_ctx)
|
port_probe_context_finished (PortProbeContext *port_probe_ctx)
|
||||||
{
|
{
|
||||||
FindDeviceSupportContext *ctx = port_probe_ctx->parent_ctx;
|
FindDeviceSupportContext *ctx = port_probe_ctx->parent_ctx;
|
||||||
|
MMPlugin *device_plugin;
|
||||||
|
|
||||||
|
/* Get info about the currently scheduled plugin in the device */
|
||||||
|
device_plugin = (MMPlugin *)mm_device_peek_plugin (ctx->device);
|
||||||
|
|
||||||
if (!port_probe_ctx->best_plugin) {
|
if (!port_probe_ctx->best_plugin) {
|
||||||
|
/* If the port appeared after an already probed port, which decided that
|
||||||
|
* the Generic plugin was the best one (which is by default not initially
|
||||||
|
* suggested), we'll end up arriving here. Don't ignore it, it may well
|
||||||
|
* be a wwan port that we do need to grab. */
|
||||||
|
if (device_plugin) {
|
||||||
|
mm_dbg ("(Plugin Manager) [%s] assuming port can be handled by the '%s' plugin",
|
||||||
|
g_udev_device_get_name (port_probe_ctx->port),
|
||||||
|
mm_plugin_get_name (device_plugin));
|
||||||
|
} else {
|
||||||
gboolean cancel_remaining;
|
gboolean cancel_remaining;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
@@ -170,12 +183,8 @@ port_probe_context_finished (PortProbeContext *port_probe_ctx)
|
|||||||
if (cancel_remaining)
|
if (cancel_remaining)
|
||||||
/* Set a NULL suggested plugin, will cancel the probes */
|
/* Set a NULL suggested plugin, will cancel the probes */
|
||||||
suggest_port_probe_result (ctx, port_probe_ctx, NULL);
|
suggest_port_probe_result (ctx, port_probe_ctx, NULL);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
MMPlugin *device_plugin;
|
|
||||||
|
|
||||||
device_plugin = (MMPlugin *)mm_device_peek_plugin (ctx->device);
|
|
||||||
|
|
||||||
/* Notify the plugin to the device, if this is the first port probing
|
/* Notify the plugin to the device, if this is the first port probing
|
||||||
* result we got.
|
* result we got.
|
||||||
* Also, if the previously suggested plugin was the GENERIC one and now
|
* Also, if the previously suggested plugin was the GENERIC one and now
|
||||||
|
Reference in New Issue
Block a user