From fd4697188a61cf3eefcda908435a6b0ac1362fc8 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 15 Nov 2017 15:18:55 +0000 Subject: [PATCH] dfu: Invalidate the DFU mode, state and status when replugging --- plugins/dfu/dfu-device.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/dfu/dfu-device.c b/plugins/dfu/dfu-device.c index 1cd1b9eed..3214608b0 100644 --- a/plugins/dfu/dfu-device.c +++ b/plugins/dfu/dfu-device.c @@ -1706,6 +1706,9 @@ dfu_device_set_new_usb_dev (DfuDevice *device, GUsbDevice *dev, g_clear_object (&priv->dev); g_ptr_array_set_size (priv->targets, 0); priv->claimed_interface = FALSE; + priv->mode = DFU_MODE_UNKNOWN; + priv->state = DFU_STATE_LAST; + priv->status = DFU_STATUS_LAST; return TRUE; } @@ -2029,7 +2032,8 @@ dfu_device_upload (DfuDevice *device, g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, - "device is not in DFU mode"); + "device is not in DFU mode, got %s", + dfu_mode_to_string (priv->mode)); return NULL; } g_debug ("detaching"); @@ -2227,7 +2231,8 @@ dfu_device_download (DfuDevice *device, g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, - "device is not in DFU mode"); + "device is not in DFU mode, got %s", + dfu_mode_to_string (priv->mode)); return FALSE; }