From 802bb313c6e74f8e47fef4b2cf04a247cfdeb76d Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 17 Oct 2019 13:32:23 +0100 Subject: [PATCH] trivial: Allow plugins to use WAIT_FOR_REPLUG in prepare and cleanup --- src/fu-engine.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/fu-engine.c b/src/fu-engine.c index 4cf6042c1..b263dc2a4 100644 --- a/src/fu-engine.c +++ b/src/fu-engine.c @@ -1839,6 +1839,14 @@ fu_engine_update_prepare (FuEngine *self, if (!fu_plugin_runner_update_prepare (plugin_tmp, flags, device, error)) return FALSE; } + + /* wait for device to disconnect and reconnect */ + if (fu_device_has_flag (device, FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG)) { + if (!fu_device_list_wait_for_replug (self->device_list, device, error)) { + g_prefix_error (error, "failed to wait for prepare replug: "); + return FALSE; + } + } return TRUE; } @@ -1860,6 +1868,14 @@ fu_engine_update_cleanup (FuEngine *self, if (!fu_plugin_runner_update_cleanup (plugin_tmp, flags, device, error)) return FALSE; } + + /* wait for device to disconnect and reconnect */ + if (fu_device_has_flag (device, FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG)) { + if (!fu_device_list_wait_for_replug (self->device_list, device, error)) { + g_prefix_error (error, "failed to wait for cleanup replug: "); + return FALSE; + } + } return TRUE; }