mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-08 01:14:43 +00:00
Add a vfunc that gets run after the device has been added
This allows per-plugin actions after the device has been open()ed and started.
This commit is contained in:
parent
9223c89019
commit
6a07870fa2
@ -89,6 +89,8 @@ gboolean fu_plugin_runner_udev_device_changed (FuPlugin *self,
|
|||||||
gboolean fu_plugin_runner_device_created (FuPlugin *self,
|
gboolean fu_plugin_runner_device_created (FuPlugin *self,
|
||||||
FuDevice *device,
|
FuDevice *device,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
void fu_plugin_runner_device_added (FuPlugin *self,
|
||||||
|
FuDevice *device);
|
||||||
void fu_plugin_runner_device_removed (FuPlugin *self,
|
void fu_plugin_runner_device_removed (FuPlugin *self,
|
||||||
FuDevice *device);
|
FuDevice *device);
|
||||||
void fu_plugin_runner_device_register (FuPlugin *self,
|
void fu_plugin_runner_device_register (FuPlugin *self,
|
||||||
|
@ -311,6 +311,17 @@ gboolean fu_plugin_udev_device_added (FuPlugin *plugin,
|
|||||||
gboolean fu_plugin_udev_device_changed (FuPlugin *plugin,
|
gboolean fu_plugin_udev_device_changed (FuPlugin *plugin,
|
||||||
FuUdevDevice *device,
|
FuUdevDevice *device,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
/**
|
||||||
|
* fu_plugin_device_added
|
||||||
|
* @plugin: A #FuPlugin
|
||||||
|
* @device: A #FuDevice
|
||||||
|
*
|
||||||
|
* Function run when the subclassed device has been added.
|
||||||
|
*
|
||||||
|
* Since: 1.5.0
|
||||||
|
**/
|
||||||
|
void fu_plugin_device_added (FuPlugin *plugin,
|
||||||
|
FuDevice *dev);
|
||||||
/**
|
/**
|
||||||
* fu_plugin_device_removed
|
* fu_plugin_device_removed
|
||||||
* @plugin: A #FuPlugin
|
* @plugin: A #FuPlugin
|
||||||
|
@ -1691,6 +1691,7 @@ fu_plugin_usb_device_added (FuPlugin *self, FuUsbDevice *device, GError **error)
|
|||||||
if (locker == NULL)
|
if (locker == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
fu_plugin_device_add (self, dev);
|
fu_plugin_device_add (self, dev);
|
||||||
|
fu_plugin_runner_device_added (self, dev);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1742,6 +1743,7 @@ fu_plugin_udev_device_added (FuPlugin *self, FuUdevDevice *device, GError **erro
|
|||||||
if (locker == NULL)
|
if (locker == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
fu_plugin_device_add (self, FU_DEVICE (dev));
|
fu_plugin_device_add (self, FU_DEVICE (dev));
|
||||||
|
fu_plugin_runner_device_added (self, dev);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1910,6 +1912,35 @@ fu_plugin_runner_udev_device_changed (FuPlugin *self, FuUdevDevice *device, GErr
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fu_plugin_runner_device_added:
|
||||||
|
* @self: a #FuPlugin
|
||||||
|
* @device: a #FuDevice
|
||||||
|
*
|
||||||
|
* Call the device_added routine for the plugin
|
||||||
|
*
|
||||||
|
* Since: 1.5.0
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
fu_plugin_runner_device_added (FuPlugin *self, FuDevice *device)
|
||||||
|
{
|
||||||
|
FuPluginPrivate *priv = GET_PRIVATE (self);
|
||||||
|
FuPluginDeviceRegisterFunc func = NULL;
|
||||||
|
|
||||||
|
/* not enabled */
|
||||||
|
if (!priv->enabled)
|
||||||
|
return;
|
||||||
|
if (priv->module == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* optional */
|
||||||
|
g_module_symbol (priv->module, "fu_plugin_device_added", (gpointer *) &func);
|
||||||
|
if (func == NULL)
|
||||||
|
return;
|
||||||
|
g_debug ("performing fu_plugin_device_added() on %s", priv->name);
|
||||||
|
func (self, device);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fu_plugin_runner_device_removed:
|
* fu_plugin_runner_device_removed:
|
||||||
* @self: a #FuPlugin
|
* @self: a #FuPlugin
|
||||||
|
@ -585,6 +585,7 @@ LIBFWUPDPLUGIN_1.5.0 {
|
|||||||
global:
|
global:
|
||||||
fu_common_filename_glob;
|
fu_common_filename_glob;
|
||||||
fu_common_is_cpu_intel;
|
fu_common_is_cpu_intel;
|
||||||
|
fu_plugin_runner_device_added;
|
||||||
fu_udev_device_get_parent_name;
|
fu_udev_device_get_parent_name;
|
||||||
fu_udev_device_get_sysfs_attr;
|
fu_udev_device_get_sysfs_attr;
|
||||||
local: *;
|
local: *;
|
||||||
|
Loading…
Reference in New Issue
Block a user