mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 20:00:28 +00:00
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:
parent
8f19ea75d3
commit
7a1d547128
@ -6670,23 +6670,25 @@ 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 */
|
||||
for (guint i = 0; i < self->backends->len; i++) {
|
||||
FuBackend *backend = g_ptr_array_index (self->backends, i);
|
||||
g_autoptr(GError) error_backend = NULL;
|
||||
if (!fu_backend_setup (backend, &error_backend)) {
|
||||
g_debug ("failed to setup backend %s: %s",
|
||||
fu_backend_get_name (backend),
|
||||
error_backend->message);
|
||||
continue;
|
||||
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;
|
||||
if (!fu_backend_setup(backend, &error_backend)) {
|
||||
g_debug("failed to setup backend %s: %s",
|
||||
fu_backend_get_name(backend),
|
||||
error_backend->message);
|
||||
continue;
|
||||
}
|
||||
backend_cnt++;
|
||||
}
|
||||
if (backend_cnt == 0) {
|
||||
g_set_error_literal(error,
|
||||
FWUPD_ERROR,
|
||||
FWUPD_ERROR_NOT_SUPPORTED,
|
||||
"all backends failed setup");
|
||||
return FALSE;
|
||||
}
|
||||
backend_cnt++;
|
||||
}
|
||||
if (backend_cnt == 0) {
|
||||
g_set_error_literal (error,
|
||||
FWUPD_ERROR,
|
||||
FWUPD_ERROR_NOT_SUPPORTED,
|
||||
"all backends failed setup");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* delete old data files */
|
||||
|
Loading…
Reference in New Issue
Block a user