plugin-manager: new methods to check for ongoing port support operations

The new mm_plugin_manager_is_finding_port_support() allows to check whether the
Plugin Manager is looking for support in a specific port.

The new mm_plugin_manager_is_checking_device_support() allows to check whether
the Plugin Manager is looking for support in any port of a given device.
This commit is contained in:
Aleksander Morgado
2011-09-06 20:13:27 +02:00
committed by Aleksander Morgado
parent 5f2d0d474c
commit fad89b1d7e
2 changed files with 63 additions and 0 deletions

View File

@@ -409,6 +409,56 @@ mm_plugin_manager_find_port_support (MMPluginManager *self,
info); info);
} }
gboolean
mm_plugin_manager_is_finding_device_support (MMPluginManager *self,
const gchar *physdev_path,
const gchar **subsys,
const gchar **name)
{
SupportsInfoList *list;
list = g_hash_table_lookup (self->priv->supports,
physdev_path);
if (list) {
if (subsys)
*subsys = ((SupportsInfo *)list->info_list->data)->subsys;
if (name)
*name = ((SupportsInfo *)list->info_list->data)->name;
return TRUE;
}
return FALSE;
}
gboolean
mm_plugin_manager_is_finding_port_support (MMPluginManager *self,
const gchar *subsys,
const gchar *name,
const gchar *physdev_path)
{
SupportsInfoList *list;
list = g_hash_table_lookup (self->priv->supports,
physdev_path);
if (list) {
GSList *l;
for (l = list->info_list;
l;
l = g_slist_next (l)) {
SupportsInfo *info = l->data;
if (g_str_equal (subsys, info->subsys) &&
g_str_equal (name, info->name)) {
/* Support check task already exists */
return TRUE;
}
}
}
return FALSE;
}
static MMPlugin * static MMPlugin *
load_plugin (const gchar *path) load_plugin (const gchar *path)
{ {

View File

@@ -59,4 +59,17 @@ MMPlugin *mm_plugin_manager_find_port_support_finish (MMPluginManager *self,
GAsyncResult *result, GAsyncResult *result,
GError **error); GError **error);
/* Returns TRUE if there is an ongoing find operation on the given port */
gboolean mm_plugin_manager_is_finding_port_support (MMPluginManager *self,
const gchar *subsys,
const gchar *name,
const gchar *physdev_path);
/* Returns TRUE if there is an ongoing find operation in a port of the given
* device (and if so, returns subsystem and name of the port) */
gboolean mm_plugin_manager_is_finding_device_support (MMPluginManager *self,
const gchar *physdev_path,
const gchar **subsys,
const gchar **name);
#endif /* MM_PLUGIN_MANAGER_H */ #endif /* MM_PLUGIN_MANAGER_H */