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.
This commit is contained in:
Richard Hughes 2018-02-01 11:43:47 +00:00
parent 83e54e46ab
commit 1a24d9da90

View File

@ -467,8 +467,12 @@ fu_device_set_platform_id (FuDevice *device, const gchar *platform_id)
g_return_if_fail (platform_id != NULL); g_return_if_fail (platform_id != NULL);
/* automatically use this */ /* automatically use this */
if (fu_device_get_id (device) == NULL) if (fu_device_get_id (device) == NULL) {
fu_device_set_id (device, platform_id); 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); fu_device_set_metadata (device, "platform-id", platform_id);
} }