Close DFU devices as soon as possible after the transfer has completed

This allows clients like 'dfu-tool watch' to report the status values correctly.
This commit is contained in:
Richard Hughes 2015-11-24 12:31:14 +00:00
parent 4d4e91da23
commit 999e96bbd4

View File

@ -325,6 +325,15 @@ fu_provider_usb_update (FuProvider *provider,
NULL,
error))
return FALSE;
/* we're done */
if (!dfu_device_close (dfu_device, &error_local)) {
g_set_error_literal (error,
FWUPD_ERROR,
FWUPD_ERROR_INTERNAL,
error_local->message);
return FALSE;
}
fu_provider_set_status (provider, FWUPD_STATUS_IDLE);
return TRUE;
}
@ -436,6 +445,15 @@ fu_provider_usb_verify (FuProvider *provider,
if (dfu_firmware == NULL)
return FALSE;
/* we're done */
if (!dfu_device_close (dfu_device, &error_local)) {
g_set_error_literal (error,
FWUPD_ERROR,
FWUPD_ERROR_INTERNAL,
error_local->message);
return FALSE;
}
/* the device never came back! */
if (!FU_IS_DEVICE (device)) {
g_set_error (error,