From 999e96bbd48cdbfa8b19cdee42c8f615adb0e68d Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 24 Nov 2015 12:31:14 +0000 Subject: [PATCH] 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. --- src/fu-provider-usb.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/fu-provider-usb.c b/src/fu-provider-usb.c index 171e442fd..391865533 100644 --- a/src/fu-provider-usb.c +++ b/src/fu-provider-usb.c @@ -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,