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:
Richard Hughes 2019-09-18 11:30:54 +01:00
parent 38245ff194
commit 33cb526248

View File

@ -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,6 +1799,8 @@ 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);
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);
@ -1818,6 +1819,12 @@ fwupd_device_to_string (FwupdDevice *device)
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);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_SUMMARY, priv->summary);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_DESCRIPTION, priv->description);