unifying: Only detach the device if required

This commit is contained in:
Richard Hughes 2017-06-22 21:09:51 +01:00
parent 43775d03f9
commit 765c679498

View File

@ -150,8 +150,9 @@ fu_plugin_update_online (FuPlugin *plugin,
/* switch to bootloader */
data->ignore_replug = TRUE;
if (lu_device_get_kind (device) == LU_DEVICE_KIND_RUNTIME) {
if (lu_device_has_flag (device, LU_DEVICE_FLAG_REQUIRES_DETACH)) {
/* wait for device to come back */
if (lu_device_has_flag (device, LU_DEVICE_FLAG_DETACH_WILL_REPLUG)) {
g_timeout_add (50, fu_plugin_unifying_detach_cb, device);
if (!lu_context_wait_for_replug (data->ctx,
device,
@ -164,6 +165,10 @@ fu_plugin_update_online (FuPlugin *plugin,
return FALSE;
if (!lu_device_open (device, error))
return FALSE;
} else {
if (!lu_device_detach (device, error))
return FALSE;
}
}
/* write the firmware */