trivial: Do not set up the backends if there is no coldplug

This speeds up fu-self-test, but more importantly fixes a intermittent
'ninja check' failure when a host USB device disconnects at exactly the
wrong time.

The FuUsbBackend code is unusual in that the setup() code sets up a
context (with a thread) which takes up to 2 seconds to timeout.
This commit is contained in:
Richard Hughes 2021-08-02 16:34:27 +01:00
parent 8f19ea75d3
commit 7a1d547128

View File

@ -6670,6 +6670,7 @@ fu_engine_load (FuEngine *self, FuEngineLoadFlags flags, GError **error)
fu_context_add_firmware_gtype (self->ctx, "ifd-firmware", FU_TYPE_IFD_FIRMWARE);
/* set up backends */
if (flags & FU_ENGINE_LOAD_FLAG_COLDPLUG) {
for (guint i = 0; i < self->backends->len; i++) {
FuBackend *backend = g_ptr_array_index(self->backends, i);
g_autoptr(GError) error_backend = NULL;
@ -6688,6 +6689,7 @@ fu_engine_load (FuEngine *self, FuEngineLoadFlags flags, GError **error)
"all backends failed setup");
return FALSE;
}
}
/* delete old data files */
if (!fu_engine_cleanup_state (error)) {