From 8da530475dc310ae95d1c09989d943f807d8569a Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 12 Jan 2018 20:30:43 +0000 Subject: [PATCH] trivial: Fix deduplication when looking for the old device ID When searching for a device by id, also include the old device in the search. --- src/fu-device-list.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/fu-device-list.c b/src/fu-device-list.c index 5d2e6be8e..435e2ba1a 100644 --- a/src/fu-device-list.c +++ b/src/fu-device-list.c @@ -203,6 +203,22 @@ fu_device_list_find_by_id (FuDeviceList *self, } } } + for (guint i = 0; i < self->devices->len; i++) { + FuDeviceItem *item_tmp = g_ptr_array_index (self->devices, i); + const gchar *ids[] = { + fu_device_get_id (item_tmp->device), + fu_device_get_equivalent_id (item_tmp->device), + NULL }; + if (item_tmp->device_old == NULL) + continue; + for (guint j = 0; ids[j] != NULL; j++) { + if (strncmp (ids[j], device_id, device_id_len) == 0) { + if (item != NULL && multiple_matches != NULL) + *multiple_matches = TRUE; + item = item_tmp; + } + } + } return item; }