From 24eec8c533d2c7add51faba1ebd86fb9f1ff23db Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 2 Jul 2021 18:22:52 +0100 Subject: [PATCH] Copy the device update state when replugging At the moment we saving the new state as 'unknown' which explains why we're getting so few LVFS reports uploaded for USB devices that perform a replug... Tested with a ColorHug2. --- src/fu-device-list.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/fu-device-list.c b/src/fu-device-list.c index 7ad16b9a7..f7cacac79 100644 --- a/src/fu-device-list.c +++ b/src/fu-device-list.c @@ -608,6 +608,15 @@ fu_device_list_replace (FuDeviceList *self, FuDeviceItem *item, FuDevice *device fu_device_set_parent (device, parent); } + /* copy the update state if known */ + if (fu_device_get_update_state (item->device) != FWUPD_UPDATE_STATE_UNKNOWN && + fu_device_get_update_state (device) == FWUPD_UPDATE_STATE_UNKNOWN) { + FwupdUpdateState update_state = fu_device_get_update_state (item->device); + g_debug ("copying update state %s to new device", + fwupd_update_state_to_string (update_state)); + fu_device_set_update_state (device, update_state); + } + /* assign the new device */ g_set_object (&item->device_old, item->device); fu_device_list_item_set_device (item, device);