flashrom: Fix loading devices in coreboot mode

We were specifying _REQUIRE_HWID but the plugin list was not yet loaded when we were trying all the HwIds.
This commit is contained in:
Richard Hughes 2022-02-09 13:49:31 +00:00
parent fd399da71b
commit b4fb6fa6aa
2 changed files with 13 additions and 7 deletions

View File

@ -7144,13 +7144,6 @@ fu_engine_load(FuEngine *self, FuEngineLoadFlags flags, GError **error)
if (flags & FU_ENGINE_LOAD_FLAG_HWINFO)
fu_context_load_hwinfo(self->ctx, NULL);
/* set quirks for each hwid */
guids = fu_context_get_hwid_guids(self->ctx);
for (guint i = 0; i < guids->len; i++) {
const gchar *hwid = g_ptr_array_index(guids, i);
fu_engine_load_quirks_for_hwid(self, hwid);
}
/* load AppStream metadata */
if (!fu_engine_load_metadata_store(self, flags, error)) {
g_prefix_error(error, "Failed to load AppStream data: ");
@ -7219,6 +7212,13 @@ fu_engine_load(FuEngine *self, FuEngineLoadFlags flags, GError **error)
return FALSE;
}
/* set quirks for each hwid */
guids = fu_context_get_hwid_guids(self->ctx);
for (guint i = 0; i < guids->len; i++) {
const gchar *hwid = g_ptr_array_index(guids, i);
fu_engine_load_quirks_for_hwid(self, hwid);
}
/* set up battery threshold */
fu_engine_context_set_battery_threshold(self->ctx);

View File

@ -121,6 +121,12 @@ fu_plugin_list_find_by_name(FuPluginList *self, const gchar *name, GError **erro
g_return_val_if_fail(name != NULL, NULL);
g_return_val_if_fail(error == NULL || *error == NULL, NULL);
/* sanity check */
if (self->plugins->len == 0) {
g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND, "no plugins loaded");
return NULL;
}
plugin = g_hash_table_lookup(self->plugins_hash, name);
if (plugin == NULL) {
g_set_error(error, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND, "no plugin %s found", name);