trivial: don't assume we know about pending_reboot

The `pending_reboot` variable is tracked by the kernel, make sure
that it is updated from the kernel when BIOS settings are changed.
This commit is contained in:
Mario Limonciello 2022-08-24 10:24:51 -05:00 committed by Mario Limonciello
parent e49c64553d
commit 2f9cb74c59
2 changed files with 8 additions and 12 deletions

View File

@ -508,7 +508,7 @@ gboolean
fu_bios_settings_get_pending_reboot(FuBiosSettings *self, gboolean *result, GError **error)
{
FwupdBiosSetting *attr;
const gchar *data;
g_autofree gchar *data = NULL;
guint64 val = 0;
g_return_val_if_fail(result != NULL, FALSE);
@ -532,7 +532,10 @@ fu_bios_settings_get_pending_reboot(FuBiosSettings *self, gboolean *result, GErr
return FALSE;
}
data = fwupd_bios_setting_get_current_value(attr);
/* refresh/re-read */
if (!fu_bios_setting_get_key(attr, NULL, &data, error))
return FALSE;
fwupd_bios_setting_set_current_value(attr, data);
if (!fu_strtoull(data, &val, 0, G_MAXUINT32, error))
return FALSE;

View File

@ -892,7 +892,7 @@ fu_engine_modify_single_bios_setting(FuEngine *self,
gboolean
fu_engine_modify_bios_settings(FuEngine *self, GHashTable *settings, GError **error)
{
FwupdBiosSetting *pending;
g_autoptr(FuBiosSettings) bios_settings = fu_context_get_bios_settings(self->ctx);
gboolean changed = FALSE;
GHashTableIter iter;
gpointer key, value;
@ -931,16 +931,9 @@ fu_engine_modify_bios_settings(FuEngine *self, GHashTable *settings, GError **er
return FALSE;
}
pending = fu_context_get_bios_setting(self->ctx, FWUPD_BIOS_SETTING_PENDING_REBOOT);
if (pending == NULL) {
g_set_error(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_FOUND,
"attribute %s not found",
FWUPD_BIOS_SETTING_PENDING_REBOOT);
if (!fu_bios_settings_get_pending_reboot(bios_settings, &changed, error))
return FALSE;
}
fwupd_bios_setting_set_current_value(pending, "1");
g_debug("pending_reboot is now %d", changed);
return TRUE;
}