dfu: Actually reload the DFU device after upgrade has completed

The m-stack DFU quirk also requires that we get the runtime status so that the
USB_DFU_SUCCESS_FUNC callback gets called. We were doing this by accident
before, and since switching to the FuDevice subclass this was dropped.

The dfu_device_refresh_and_clear() function is safe to call on a device which
does not have a working runtime interface.
This commit is contained in:
Richard Hughes 2020-03-12 15:41:11 +00:00
parent 0e39ff0ef8
commit 7825ae8dd1

View File

@ -963,6 +963,13 @@ dfu_device_request_detach (DfuDevice *self, GError **error)
return TRUE;
}
static gboolean
dfu_device_reload (FuDevice *device, GError **error)
{
DfuDevice *self = DFU_DEVICE (device);
return dfu_device_refresh_and_clear (self, error);
}
static gboolean
dfu_device_detach (FuDevice *device, GError **error)
{
@ -1796,6 +1803,7 @@ dfu_device_class_init (DfuDeviceClass *klass)
klass_device->write_firmware = dfu_device_write_firmware;
klass_device->attach = dfu_device_attach;
klass_device->detach = dfu_device_detach;
klass_device->reload = dfu_device_reload;
klass_usb_device->open = dfu_device_open;
klass_usb_device->close = dfu_device_close;
klass_usb_device->probe = dfu_device_probe;