mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-06 14:32:56 +00:00
Print the instance IDs if the GUIDs are unconverted
This caused some head scratching about the 'missing' values when doing fu_device_to_string() before fu_device_convert_instance_ids() had been called.
This commit is contained in:
parent
38245ff194
commit
33cb526248
@ -1789,7 +1789,6 @@ fwupd_device_to_string (FwupdDevice *device)
|
||||
{
|
||||
FwupdDevicePrivate *priv = GET_PRIVATE (device);
|
||||
GString *str;
|
||||
g_autoptr(GHashTable) ids = NULL;
|
||||
|
||||
g_return_val_if_fail (FWUPD_IS_DEVICE (device), NULL);
|
||||
|
||||
@ -1800,22 +1799,30 @@ fwupd_device_to_string (FwupdDevice *device)
|
||||
str = g_string_append (str, "Unknown Device\n");
|
||||
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_DEVICE_ID, priv->id);
|
||||
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_PARENT_DEVICE_ID, priv->parent_id);
|
||||
ids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
for (guint i = 0; i < priv->instance_ids->len; i++) {
|
||||
const gchar *instance_id = g_ptr_array_index (priv->instance_ids, i);
|
||||
g_hash_table_insert (ids,
|
||||
fwupd_guid_hash_string (instance_id),
|
||||
g_strdup (instance_id));
|
||||
}
|
||||
for (guint i = 0; i < priv->guids->len; i++) {
|
||||
const gchar *guid = g_ptr_array_index (priv->guids, i);
|
||||
const gchar *instance_id = g_hash_table_lookup (ids, guid);
|
||||
if (instance_id == NULL) {
|
||||
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_GUID, guid);
|
||||
} else {
|
||||
g_autofree gchar *tmp = NULL;
|
||||
tmp = g_strdup_printf ("%s <- %s", guid, instance_id);
|
||||
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_GUID, tmp);
|
||||
if (priv->guids->len > 0) {
|
||||
g_autoptr(GHashTable) ids = NULL;
|
||||
ids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
for (guint i = 0; i < priv->instance_ids->len; i++) {
|
||||
const gchar *instance_id = g_ptr_array_index (priv->instance_ids, i);
|
||||
g_hash_table_insert (ids,
|
||||
fwupd_guid_hash_string (instance_id),
|
||||
g_strdup (instance_id));
|
||||
}
|
||||
for (guint i = 0; i < priv->guids->len; i++) {
|
||||
const gchar *guid = g_ptr_array_index (priv->guids, i);
|
||||
const gchar *instance_id = g_hash_table_lookup (ids, guid);
|
||||
if (instance_id == NULL) {
|
||||
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_GUID, guid);
|
||||
} else {
|
||||
g_autofree gchar *tmp = NULL;
|
||||
tmp = g_strdup_printf ("%s <- %s", guid, instance_id);
|
||||
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_GUID, tmp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (guint i = 0; i < priv->instance_ids->len; i++) {
|
||||
const gchar *instance_id = g_ptr_array_index (priv->instance_ids, i);
|
||||
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_INSTANCE_IDS, instance_id);
|
||||
}
|
||||
}
|
||||
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_SERIAL, priv->serial);
|
||||
|
Loading…
Reference in New Issue
Block a user