mirror of
https://git.proxmox.com/git/fwupd
synced 2025-06-09 20:06:11 +00:00
bios-settings: Fix plugin functionality
By moving the attribute loading into udev it was loading too late and plugins couldn't use it. Move the loading to earlier in the daemon and ignore add events if we already have attributes loaded. Fixes: #4979
This commit is contained in:
parent
473459c93d
commit
ad461d504d
@ -590,6 +590,7 @@ fu_context_load_hwinfo(FuContext *self, GError **error)
|
|||||||
GPtrArray *guids;
|
GPtrArray *guids;
|
||||||
g_autoptr(GError) error_smbios = NULL;
|
g_autoptr(GError) error_smbios = NULL;
|
||||||
g_autoptr(GError) error_hwids = NULL;
|
g_autoptr(GError) error_hwids = NULL;
|
||||||
|
g_autoptr(GError) error_bios_settings = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail(FU_IS_CONTEXT(self), FALSE);
|
g_return_val_if_fail(FU_IS_CONTEXT(self), FALSE);
|
||||||
g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
|
||||||
@ -614,8 +615,9 @@ fu_context_load_hwinfo(FuContext *self, GError **error)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set it up so that udev will load firmware attributes */
|
|
||||||
fu_context_add_udev_subsystem(self, "firmware-attributes");
|
fu_context_add_udev_subsystem(self, "firmware-attributes");
|
||||||
|
if (!fu_context_reload_bios_settings(self, &error_bios_settings))
|
||||||
|
g_debug("%s", error_bios_settings->message);
|
||||||
|
|
||||||
/* always */
|
/* always */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -6926,7 +6926,7 @@ fu_engine_apply_default_bios_settings_policy(FuEngine *self, GError **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fu_engine_check_firmware_attributes(FuEngine *self, FuDevice *device)
|
fu_engine_check_firmware_attributes(FuEngine *self, FuDevice *device, gboolean added)
|
||||||
{
|
{
|
||||||
const gchar *subsystem;
|
const gchar *subsystem;
|
||||||
|
|
||||||
@ -6937,6 +6937,15 @@ fu_engine_check_firmware_attributes(FuEngine *self, FuDevice *device)
|
|||||||
subsystem = fu_udev_device_get_subsystem(FU_UDEV_DEVICE(device));
|
subsystem = fu_udev_device_get_subsystem(FU_UDEV_DEVICE(device));
|
||||||
if (g_strcmp0(subsystem, "firmware-attributes") == 0) {
|
if (g_strcmp0(subsystem, "firmware-attributes") == 0) {
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
if (added) {
|
||||||
|
FuBiosSettings *settings = fu_context_get_bios_settings(self->ctx);
|
||||||
|
g_autoptr(GPtrArray) items = fu_bios_settings_get_all(settings);
|
||||||
|
|
||||||
|
if (items->len > 0) {
|
||||||
|
g_debug("ignoring add event for already loaded settings");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!fu_context_reload_bios_settings(self->ctx, &error)) {
|
if (!fu_context_reload_bios_settings(self->ctx, &error)) {
|
||||||
g_debug("%s", error->message);
|
g_debug("%s", error->message);
|
||||||
return;
|
return;
|
||||||
@ -6958,7 +6967,7 @@ fu_engine_backend_device_removed_cb(FuBackend *backend, FuDevice *device, FuEngi
|
|||||||
g_autoptr(GPtrArray) devices = NULL;
|
g_autoptr(GPtrArray) devices = NULL;
|
||||||
|
|
||||||
/* if this is for firmware attributes, reload that part of the daemon */
|
/* if this is for firmware attributes, reload that part of the daemon */
|
||||||
fu_engine_check_firmware_attributes(self, device);
|
fu_engine_check_firmware_attributes(self, device, FALSE);
|
||||||
|
|
||||||
/* debug */
|
/* debug */
|
||||||
if (g_getenv("FWUPD_PROBE_VERBOSE") != NULL) {
|
if (g_getenv("FWUPD_PROBE_VERBOSE") != NULL) {
|
||||||
@ -7101,7 +7110,7 @@ fu_engine_backend_device_added(FuEngine *self, FuDevice *device, FuProgress *pro
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* if this is for firmware attributes, reload that part of the daemon */
|
/* if this is for firmware attributes, reload that part of the daemon */
|
||||||
fu_engine_check_firmware_attributes(self, device);
|
fu_engine_check_firmware_attributes(self, device, TRUE);
|
||||||
|
|
||||||
/* can be specified using a quirk */
|
/* can be specified using a quirk */
|
||||||
fu_engine_backend_device_added_run_plugins(self, device, fu_progress_get_child(progress));
|
fu_engine_backend_device_added_run_plugins(self, device, fu_progress_get_child(progress));
|
||||||
|
Loading…
Reference in New Issue
Block a user