Show a more detailed error when installing firmware on the wildcard

Based on a patch by Mario Limonciello, many thanks.
This commit is contained in:
Richard Hughes 2016-07-04 13:04:27 +01:00
parent bd40528575
commit c8646aff32

View File

@ -846,6 +846,7 @@ static gboolean
fu_main_update_helper (FuMainAuthHelper *helper, GError **error) fu_main_update_helper (FuMainAuthHelper *helper, GError **error)
{ {
guint i; guint i;
g_autoptr(GError) error_first = NULL;
/* load store file which also decompresses firmware */ /* load store file which also decompresses firmware */
fu_main_set_status (helper->priv, FWUPD_STATUS_DECOMPRESSING); fu_main_set_status (helper->priv, FWUPD_STATUS_DECOMPRESSING);
@ -882,6 +883,10 @@ fu_main_update_helper (FuMainAuthHelper *helper, GError **error)
g_debug ("failed to add %s: %s", g_debug ("failed to add %s: %s",
fu_device_get_id (item->device), fu_device_get_id (item->device),
error_local->message); error_local->message);
/* save this for later */
if (error_first == NULL)
error_first = g_error_copy (error_local);
continue; continue;
} }
@ -891,11 +896,19 @@ fu_main_update_helper (FuMainAuthHelper *helper, GError **error)
if (helper->devices->len == 0) { if (helper->devices->len == 0) {
g_autofree gchar *guid = NULL; g_autofree gchar *guid = NULL;
guid = fu_main_get_guids_from_store (helper->store); guid = fu_main_get_guids_from_store (helper->store);
if (error_first != NULL) {
g_set_error (error,
FWUPD_ERROR,
FWUPD_ERROR_INVALID_FILE,
"no attached hardware matched %s: %s",
guid, error_first->message);
} else {
g_set_error (error, g_set_error (error,
FWUPD_ERROR, FWUPD_ERROR,
FWUPD_ERROR_INVALID_FILE, FWUPD_ERROR_INVALID_FILE,
"no attached hardware matched %s", "no attached hardware matched %s",
guid); guid);
}
return FALSE; return FALSE;
} }