plugin-manager,plugin: run pre-probing filters early

For each port, we will construct the list of plugins to test with. In that list
we will include those plugins which are likely to handle a given port, so we
will skip all those which aren't.

To see if a plugin is likely or not, we will run the pre-probing filters before
adding them to the list, with the new `mm_plugin_discard_port_early()'. This
method will return one of these hints:

 * UNSUPPORTED: The plugin will not be able to handle this port.
 * MAYBE: The plugin may handle this port.
 * LIKELY: The plugin may (very likely) handle this port.
 * SUPPORTED: If any plugin should support the port, this is it.

Plugins reported to be 'likely' supporting the port will be probed before the
ones reported just as 'maybe'.

If a plugin reports 'supported' only that one and the fallback generic ones will
be tried.
This commit is contained in:
Aleksander Morgado
2012-10-30 15:35:58 +01:00
parent e5b4b4d0e5
commit 0ca6ae1b4b
3 changed files with 152 additions and 64 deletions
+13 -2
View File
@@ -67,6 +67,13 @@ typedef enum {
MM_PLUGIN_SUPPORTS_PORT_SUPPORTED
} MMPluginSupportsResult;
typedef enum {
MM_PLUGIN_SUPPORTS_HINT_UNSUPPORTED,
MM_PLUGIN_SUPPORTS_HINT_MAYBE,
MM_PLUGIN_SUPPORTS_HINT_LIKELY,
MM_PLUGIN_SUPPORTS_HINT_SUPPORTED,
} MMPluginSupportsHint;
typedef struct _MMPlugin MMPlugin;
typedef struct _MMPluginClass MMPluginClass;
typedef struct _MMPluginPrivate MMPluginPrivate;
@@ -102,8 +109,12 @@ struct _MMPluginClass {
GType mm_plugin_get_type (void);
const gchar *mm_plugin_get_name (MMPlugin *plugin);
gint mm_plugin_cmp (const MMPlugin *plugin_a,
const MMPlugin *plugin_b);
/* This method will run all pre-probing filters, to see if we can discard this
* plugin from the probing logic as soon as possible. */
MMPluginSupportsHint mm_plugin_discard_port_early (MMPlugin *plugin,
MMDevice *device,
GUdevDevice *port);
void mm_plugin_supports_port (MMPlugin *plugin,
MMDevice *device,