mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-13 23:22:56 +00:00
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:
parent
e49c64553d
commit
2f9cb74c59
@ -508,7 +508,7 @@ gboolean
|
|||||||
fu_bios_settings_get_pending_reboot(FuBiosSettings *self, gboolean *result, GError **error)
|
fu_bios_settings_get_pending_reboot(FuBiosSettings *self, gboolean *result, GError **error)
|
||||||
{
|
{
|
||||||
FwupdBiosSetting *attr;
|
FwupdBiosSetting *attr;
|
||||||
const gchar *data;
|
g_autofree gchar *data = NULL;
|
||||||
guint64 val = 0;
|
guint64 val = 0;
|
||||||
|
|
||||||
g_return_val_if_fail(result != NULL, FALSE);
|
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;
|
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))
|
if (!fu_strtoull(data, &val, 0, G_MAXUINT32, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -892,7 +892,7 @@ fu_engine_modify_single_bios_setting(FuEngine *self,
|
|||||||
gboolean
|
gboolean
|
||||||
fu_engine_modify_bios_settings(FuEngine *self, GHashTable *settings, GError **error)
|
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;
|
gboolean changed = FALSE;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
gpointer key, value;
|
gpointer key, value;
|
||||||
@ -931,16 +931,9 @@ fu_engine_modify_bios_settings(FuEngine *self, GHashTable *settings, GError **er
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pending = fu_context_get_bios_setting(self->ctx, FWUPD_BIOS_SETTING_PENDING_REBOOT);
|
if (!fu_bios_settings_get_pending_reboot(bios_settings, &changed, error))
|
||||||
if (pending == NULL) {
|
|
||||||
g_set_error(error,
|
|
||||||
FWUPD_ERROR,
|
|
||||||
FWUPD_ERROR_NOT_FOUND,
|
|
||||||
"attribute %s not found",
|
|
||||||
FWUPD_BIOS_SETTING_PENDING_REBOOT);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
g_debug("pending_reboot is now %d", changed);
|
||||||
fwupd_bios_setting_set_current_value(pending, "1");
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user