From 1a24d9da909c2e09ee6d9609d66c49bf6cae7023 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 1 Feb 2018 11:43:47 +0000 Subject: [PATCH] Include the device VID and PID in the calculation of the device-id If we plug in USB device A, remove it, plug in USB device B and get the same autogenerated string all kinds of nasty things happen to the history database. --- src/fu-device.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fu-device.c b/src/fu-device.c index 077013ce0..208769964 100644 --- a/src/fu-device.c +++ b/src/fu-device.c @@ -467,8 +467,12 @@ fu_device_set_platform_id (FuDevice *device, const gchar *platform_id) g_return_if_fail (platform_id != NULL); /* automatically use this */ - if (fu_device_get_id (device) == NULL) - fu_device_set_id (device, platform_id); + if (fu_device_get_id (device) == NULL) { + g_autofree gchar *id_guid = NULL; + id_guid = g_strdup_printf ("%s:%s", platform_id, + fu_device_get_guid_default (device)); + fu_device_set_id (device, id_guid); + } fu_device_set_metadata (device, "platform-id", platform_id); }