trivial: Allow plugins to use WAIT_FOR_REPLUG in prepare and cleanup

This commit is contained in:
Richard Hughes 2019-10-17 13:32:23 +01:00
parent b05d39adff
commit 802bb313c6

View File

@ -1839,6 +1839,14 @@ fu_engine_update_prepare (FuEngine *self,
if (!fu_plugin_runner_update_prepare (plugin_tmp, flags, device, error)) if (!fu_plugin_runner_update_prepare (plugin_tmp, flags, device, error))
return FALSE; 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; return TRUE;
} }
@ -1860,6 +1868,14 @@ fu_engine_update_cleanup (FuEngine *self,
if (!fu_plugin_runner_update_cleanup (plugin_tmp, flags, device, error)) if (!fu_plugin_runner_update_cleanup (plugin_tmp, flags, device, error))
return FALSE; 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; return TRUE;
} }