plugins: propagate cached probing result to supports task

We need to ensure that the supports task always has the results of the probing,
no matter if the probing was just launched by the plugin grabbing the port, or
by a previous plugin. We do this during supports_port(), by propagating to the
supports task any possible previously cached probing results.
This commit is contained in:
Aleksander Morgado
2011-06-02 12:33:09 +02:00
parent 3921559901
commit f9f6d1dfdb
20 changed files with 166 additions and 104 deletions

View File

@@ -68,7 +68,6 @@ supports_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task)
{
GUdevDevice *port;
guint32 cached = 0, level;
guint16 vendor = 0;
const char *subsys, *name;
@@ -87,8 +86,12 @@ supports_port (MMPluginBase *base,
if (vendor != 0x1e0e)
return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
if (mm_plugin_base_get_cached_port_capabilities (base, port, &cached)) {
level = get_level_for_capabilities (cached);
/* Check if a previous probing was already launched in this port */
if (mm_plugin_base_supports_task_propagate_cached (task)) {
guint32 level;
/* A previous probing was already done, use its results */
level = get_level_for_capabilities (mm_plugin_base_supports_task_get_probed_capabilities (task));
if (level) {
mm_plugin_base_supports_task_complete (task, level);
return MM_PLUGIN_SUPPORTS_PORT_IN_PROGRESS;