uefi: Upload the historical result without using libfwup

This commit is contained in:
Richard Hughes 2018-06-25 16:00:50 +01:00
parent b157d6eff9
commit 11d62030a3

View File

@ -126,32 +126,21 @@ fu_plugin_clear_results (FuPlugin *plugin, FuDevice *device, GError **error)
gboolean
fu_plugin_get_results (FuPlugin *plugin, FuDevice *device, GError **error)
{
FuUefiDevice *device_uefi = FU_UEFI_DEVICE (device);
FuUefiDeviceStatus status = fu_uefi_device_get_status (device_uefi);
const gchar *tmp;
fwup_resource *re = NULL;
guint32 status = 0;
guint32 version = 0;
time_t when = 0;
g_autoptr(fwup_resource_iter) iter = NULL;
g_autofree gchar *err_msg = NULL;
g_autofree gchar *version_str = NULL;
/* get the hardware we're referencing */
fwup_resource_iter_create (&iter);
re = fu_plugin_uefi_find_resource (iter, device, error);
if (re == NULL)
return FALSE;
if (fwup_get_last_attempt_info (re, &version, &status, &when) < 0) {
g_set_error (error,
FWUPD_ERROR,
FWUPD_ERROR_INTERNAL,
"Cannot get UEFI status for %s",
fu_device_get_guid_default (device));
return FALSE;
}
/* trivial case */
if (status == FU_UEFI_DEVICE_STATUS_SUCCESS) {
fu_device_set_update_state (device, FWUPD_UPDATE_STATE_SUCCESS);
} else {
g_autofree gchar *err_msg = NULL;
g_autofree gchar *version_str = g_strdup_printf ("%u", version);
return TRUE;
}
/* something went wrong */
fu_device_set_update_state (device, FWUPD_UPDATE_STATE_FAILED);
version_str = g_strdup_printf ("%u", fu_uefi_device_get_version_error (device_uefi));
tmp = fu_uefi_device_status_to_string (status);
if (tmp == NULL) {
err_msg = g_strdup_printf ("failed to update to %s",
@ -161,7 +150,6 @@ fu_plugin_get_results (FuPlugin *plugin, FuDevice *device, GError **error)
version_str, tmp);
}
fu_device_set_update_error (device, err_msg);
}
return TRUE;
}