Skip cleanup after device is done updating if will-disappear is set (Fixes: #1529)

This fixes a regression introduced by 2031ce3bf6
that leads to:
```
USB error on device 2dc8:5750 : No such device (it may have been disconnected) [-4]
```
This commit is contained in:
Mario Limonciello 2019-11-09 22:10:35 -06:00 committed by Mario Limonciello
parent 8b044c6cb3
commit e2b8a2797e
2 changed files with 16 additions and 3 deletions

View File

@ -512,8 +512,14 @@ fu_ebitdo_device_write_firmware (FuDevice *device,
/* when doing a soft-reboot the device does not re-enumerate properly
* so manually reboot the GUsbDevice */
fu_device_set_status (device, FWUPD_STATUS_DEVICE_RESTART);
if (!g_usb_device_reset (usb_device, error)) {
g_prefix_error (error, "failed to force-reset device: ");
if (!g_usb_device_reset (usb_device, &error_local)) {
g_prefix_error (&error_local, "failed to force-reset device: ");
if (fu_device_has_flag (device, FWUPD_DEVICE_FLAG_WILL_DISAPPEAR)) {
fu_device_set_remove_delay (device, 0);
g_debug ("%s", error_local->message);
return TRUE;
}
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}

View File

@ -1872,7 +1872,14 @@ fu_engine_device_cleanup (FuEngine *self,
FwupdInstallFlags flags,
GError **error)
{
g_autoptr(FuDeviceLocker) locker = fu_device_locker_new (device, error);
g_autoptr(FuDeviceLocker) locker = NULL;
if (fu_device_has_flag (device, FWUPD_DEVICE_FLAG_WILL_DISAPPEAR)) {
g_debug ("skipping device cleanup due to will-disappear flag");
return TRUE;
}
locker = fu_device_locker_new (device, error);
if (locker == NULL)
return FALSE;
return fu_device_cleanup (device, flags, error);