mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 05:57:41 +00:00
fu-plugin: add a new udev_device_changed function that calls rescan
This commit is contained in:
parent
0d207d8dea
commit
096e3cfbb6
@ -1694,6 +1694,18 @@ fu_plugin_usb_device_added (FuPlugin *self, FuUsbDevice *device, GError **error)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_plugin_udev_device_changed (FuPlugin *self, FuUdevDevice *device, GError **error)
|
||||
{
|
||||
g_autoptr(FuDeviceLocker) locker = NULL;
|
||||
|
||||
/* open */
|
||||
locker = fu_device_locker_new (FU_DEVICE (device), error);
|
||||
if (locker == NULL)
|
||||
return FALSE;
|
||||
return fu_device_rescan (FU_DEVICE (device), error);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_plugin_udev_device_added (FuPlugin *self, FuUdevDevice *device, GError **error)
|
||||
{
|
||||
@ -1872,8 +1884,14 @@ fu_plugin_runner_udev_device_changed (FuPlugin *self, FuUdevDevice *device, GErr
|
||||
|
||||
/* optional */
|
||||
g_module_symbol (priv->module, "fu_plugin_udev_device_changed", (gpointer *) &func);
|
||||
if (func == NULL)
|
||||
if (func == NULL) {
|
||||
if (priv->device_gtype != G_TYPE_INVALID ||
|
||||
fu_device_get_specialized_gtype (FU_DEVICE (device)) != G_TYPE_INVALID) {
|
||||
if (!fu_plugin_udev_device_changed (self, device, error))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
g_debug ("performing udev_device_changed() on %s", priv->name);
|
||||
if (!func (self, device, &error_local)) {
|
||||
if (error_local == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user