From 7e77bf311662dd13b1f04377f16a45a5e7dcad12 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 8 May 2018 14:56:46 +0100 Subject: [PATCH] trivial: Be consistent with 'name [id]' in debug output Based on a patch by Mario Limonciello , many thanks. --- src/fu-engine.c | 25 ++++++++++++++++--------- src/fu-history.c | 23 ++++++++++++++++------- src/fu-install-task.c | 16 ++++++++++------ 3 files changed, 42 insertions(+), 22 deletions(-) diff --git a/src/fu-engine.c b/src/fu-engine.c index 2bd4b348a..6c7880596 100644 --- a/src/fu-engine.c +++ b/src/fu-engine.c @@ -2126,8 +2126,8 @@ fu_engine_get_releases_for_device (FuEngine *self, FuDevice *device, GError **er FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, "ignoring %s [%s] as not updatable", - fu_device_get_id (device), - fu_device_get_name (device)); + fu_device_get_name (device), + fu_device_get_id (device)); return NULL; } @@ -2470,7 +2470,8 @@ fu_engine_get_results (FuEngine *self, const gchar *device_id, GError **error) g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_NOTHING_TO_DO, - "User has already been notified about %s", + "User has already been notified about %s [%s]", + fu_device_get_name (device), fu_device_get_id (device)); return NULL; } @@ -2625,8 +2626,10 @@ fu_engine_adopt_children (FuEngine *self, FuDevice *device) if (fu_device_get_parent (device) != NULL) continue; if (fu_device_has_guid (device_tmp, guid)) { - g_debug ("setting parent of %s to be %s", + g_debug ("setting parent of %s [%s] to be %s [%s]", + fu_device_get_name (device), fu_device_get_id (device), + fu_device_get_name (device_tmp), fu_device_get_id (device_tmp)); fu_device_add_child (device_tmp, device); break; @@ -2643,8 +2646,10 @@ fu_engine_adopt_children (FuEngine *self, FuDevice *device) if (fu_device_get_parent (device_tmp) != NULL) continue; if (fu_device_has_parent_guid (device_tmp, guid)) { - g_debug ("setting parent of %s to be %s", + g_debug ("setting parent of %s [%s] to be %s [%s]", + fu_device_get_name (device_tmp), fu_device_get_id (device_tmp), + fu_device_get_name (device), fu_device_get_id (device)); fu_device_add_child (device, device_tmp); } @@ -2662,8 +2667,8 @@ fu_engine_add_device (FuEngine *self, FuDevice *device) device_guids = fu_device_get_guids (device); if (device_guids->len == 0) { g_warning ("no GUIDs for device %s [%s]", - fu_device_get_id (device), - fu_device_get_name (device)); + fu_device_get_name (device), + fu_device_get_id (device)); return; } @@ -2674,8 +2679,10 @@ fu_engine_add_device (FuEngine *self, FuDevice *device) for (guint j = 0; j < device_guids->len; j++) { const gchar *device_guid = g_ptr_array_index (device_guids, j); if (g_strcmp0 (blacklisted_guid, device_guid) == 0) { - g_debug ("%s is blacklisted [%s], ignoring from %s", - fu_device_get_id (device), device_guid, + g_debug ("%s [%s] is blacklisted [%s], ignoring from %s", + fu_device_get_name (device), + fu_device_get_id (device), + device_guid, fu_device_get_plugin (device)); return; } diff --git a/src/fu-history.c b/src/fu-history.c index 98cf19018..65bd53604 100644 --- a/src/fu-history.c +++ b/src/fu-history.c @@ -343,7 +343,8 @@ fu_history_modify_device (FuHistory *self, FuDevice *device, /* overwrite entry if it exists */ if ((flags & FU_HISTORY_FLAGS_MATCH_OLD_VERSION) && (flags & FU_HISTORY_FLAGS_MATCH_NEW_VERSION)) { - g_debug ("FuHistory: modifying device %s, version not important", + g_debug ("FuHistory: modifying device %s [%s], version not important", + fu_device_get_name (device), fu_device_get_id (device)); rc = sqlite3_prepare_v2 (self->db, "UPDATE history SET " @@ -353,8 +354,10 @@ fu_history_modify_device (FuHistory *self, FuDevice *device, "WHERE device_id = ?4;", -1, &stmt, NULL); } else if (flags & FU_HISTORY_FLAGS_MATCH_OLD_VERSION) { - g_debug ("FuHistory: modifying device %s, only version old %s", - fu_device_get_id (device), fu_device_get_version (device)); + g_debug ("FuHistory: modifying device %s [%s], only version old %s", + fu_device_get_name (device), + fu_device_get_id (device), + fu_device_get_version (device)); rc = sqlite3_prepare_v2 (self->db, "UPDATE history SET " "update_state = ?1, " @@ -363,8 +366,10 @@ fu_history_modify_device (FuHistory *self, FuDevice *device, "WHERE device_id = ?4 AND version_old = ?5;", -1, &stmt, NULL); } else if (flags & FU_HISTORY_FLAGS_MATCH_NEW_VERSION) { - g_debug ("FuHistory: modifying device %s, only version new %s", - fu_device_get_id (device), fu_device_get_version (device)); + g_debug ("FuHistory: modifying device %s [%s], only version new %s", + fu_device_get_name (device), + fu_device_get_id (device), + fu_device_get_version (device)); rc = sqlite3_prepare_v2 (self->db, "UPDATE history SET " "update_state = ?1, " @@ -409,7 +414,9 @@ fu_history_add_device (FuHistory *self, FuDevice *device, FwupdRelease *release, if (!fu_history_remove_device (self, device, release, error)) return FALSE; - g_debug ("FuHistory: add device %s", fu_device_get_id (device)); + g_debug ("FuHistory: add device %s [%s]", + fu_device_get_name (device), + fu_device_get_id (device)); if (release != NULL) { GPtrArray *checksums = fwupd_release_get_checksums (release); checksum = fwupd_checksum_get_by_kind (checksums, G_CHECKSUM_SHA1); @@ -528,7 +535,9 @@ fu_history_remove_device (FuHistory *self, FuDevice *device, if (!fu_history_load (self, error)) return FALSE; - g_debug ("FuHistory: remove device %s", fu_device_get_id (device)); + g_debug ("FuHistory: remove device %s [%s]", + fu_device_get_name (device), + fu_device_get_id (device)); rc = sqlite3_prepare_v2 (self->db, "DELETE FROM history WHERE device_id = ?1 " "AND version_old = ?2 " diff --git a/src/fu-install-task.c b/src/fu-install-task.c index 7af058abc..7b2a89ac9 100644 --- a/src/fu-install-task.c +++ b/src/fu-install-task.c @@ -155,7 +155,8 @@ fu_install_task_check_requirements (FuInstallTask *self, g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, - "Device %s is locked", + "Device %s [%s] is locked", + fu_device_get_name (self->device), fu_device_get_id (self->device)); return FALSE; } @@ -165,7 +166,8 @@ fu_install_task_check_requirements (FuInstallTask *self, g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, - "Device %s does not currently allow updates", + "Device %s [%s] does not currently allow updates", + fu_device_get_name (self->device), fu_device_get_id (self->device)); return FALSE; } @@ -176,7 +178,8 @@ fu_install_task_check_requirements (FuInstallTask *self, g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, - "Device %s only allows offline updates", + "Device %s [%s] only allows offline updates", + fu_device_get_name (self->device), fu_device_get_id (self->device)); return FALSE; } @@ -187,7 +190,8 @@ fu_install_task_check_requirements (FuInstallTask *self, g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_INTERNAL, - "Device with ID %s has no firmware version", + "Device %s [%s] has no firmware version", + fu_device_get_name (self->device), fu_device_get_id (self->device)); return FALSE; } @@ -199,8 +203,8 @@ fu_install_task_check_requirements (FuInstallTask *self, FWUPD_ERROR, FWUPD_ERROR_INVALID_FILE, "%s [%s] has no firmware update metadata", - fu_device_get_id (self->device), - fu_device_get_name (self->device)); + fu_device_get_name (self->device), + fu_device_get_id (self->device)); return FALSE; }