mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-05 00:38:35 +00:00
Show results when calling get-details if failing requirements
This commit is contained in:
parent
46b3eb0f82
commit
b728608baa
@ -2546,13 +2546,17 @@ fu_device_ensure_inhibits(FuDevice *self)
|
||||
g_signal_handler_block(self, priv->notify_flags_handler_id);
|
||||
|
||||
/* was okay -> not okay */
|
||||
if (fu_device_has_flag(self, FWUPD_DEVICE_FLAG_UPDATABLE) && nr_inhibits > 0) {
|
||||
if (nr_inhibits > 0) {
|
||||
g_autofree gchar *reasons_str = NULL;
|
||||
g_autoptr(GList) values = g_hash_table_get_values(priv->inhibits);
|
||||
g_autoptr(GPtrArray) reasons = g_ptr_array_new();
|
||||
|
||||
fu_device_remove_flag(self, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||
fu_device_add_flag(self, FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN);
|
||||
/* updatable -> updatable-hidden -- which is required as devices might have
|
||||
* inhibits and *not* be automatically updatable */
|
||||
if (fu_device_has_flag(self, FWUPD_DEVICE_FLAG_UPDATABLE)) {
|
||||
fu_device_remove_flag(self, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||
fu_device_add_flag(self, FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN);
|
||||
}
|
||||
|
||||
/* update update error */
|
||||
for (GList *l = values; l != NULL; l = l->next) {
|
||||
@ -2561,12 +2565,11 @@ fu_device_ensure_inhibits(FuDevice *self)
|
||||
}
|
||||
reasons_str = fu_common_strjoin_array(", ", reasons);
|
||||
fu_device_set_update_error(self, reasons_str);
|
||||
}
|
||||
|
||||
/* not okay -> is okay */
|
||||
if (fu_device_has_flag(self, FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN) && nr_inhibits == 0) {
|
||||
fu_device_remove_flag(self, FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN);
|
||||
fu_device_add_flag(self, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||
} else {
|
||||
if (fu_device_has_flag(self, FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN)) {
|
||||
fu_device_remove_flag(self, FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN);
|
||||
fu_device_add_flag(self, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||
}
|
||||
fu_device_set_update_error(self, NULL);
|
||||
}
|
||||
|
||||
|
@ -1776,6 +1776,28 @@ fu_device_inhibit_func(void)
|
||||
g_assert_false(fu_device_has_flag(device, FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN));
|
||||
}
|
||||
|
||||
static void
|
||||
fu_device_inhibit_updateable_func(void)
|
||||
{
|
||||
g_autoptr(FuDevice) device = fu_device_new();
|
||||
|
||||
g_assert_false(fu_device_has_flag(device, FWUPD_DEVICE_FLAG_UPDATABLE));
|
||||
g_assert_false(fu_device_has_flag(device, FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN));
|
||||
g_assert_cmpstr(fu_device_get_update_error(device), ==, NULL);
|
||||
|
||||
/* first one */
|
||||
fu_device_inhibit(device, "needs-activation", "Device is pending activation");
|
||||
g_assert_false(fu_device_has_flag(device, FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN));
|
||||
g_assert_false(fu_device_has_flag(device, FWUPD_DEVICE_FLAG_UPDATABLE));
|
||||
g_assert_cmpstr(fu_device_get_update_error(device), ==, "Device is pending activation");
|
||||
|
||||
/* activated, but still not updatable */
|
||||
fu_device_uninhibit(device, "needs-activation");
|
||||
g_assert_false(fu_device_has_flag(device, FWUPD_DEVICE_FLAG_UPDATABLE));
|
||||
g_assert_false(fu_device_has_flag(device, FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN));
|
||||
g_assert_cmpstr(fu_device_get_update_error(device), ==, NULL);
|
||||
}
|
||||
|
||||
#define TEST_FLAG_FOO (1 << 0)
|
||||
#define TEST_FLAG_BAR (1 << 1)
|
||||
#define TEST_FLAG_BAZ (1 << 2)
|
||||
@ -3950,6 +3972,7 @@ main(int argc, char **argv)
|
||||
g_test_add_func("/fwupd/device{flags}", fu_device_flags_func);
|
||||
g_test_add_func("/fwupd/device{custom-flags}", fu_device_private_flags_func);
|
||||
g_test_add_func("/fwupd/device{inhibit}", fu_device_inhibit_func);
|
||||
g_test_add_func("/fwupd/device{inhibit-updateable}", fu_device_inhibit_updateable_func);
|
||||
g_test_add_func("/fwupd/device{parent}", fu_device_parent_func);
|
||||
g_test_add_func("/fwupd/device{children}", fu_device_children_func);
|
||||
g_test_add_func("/fwupd/device{incorporate}", fu_device_incorporate_func);
|
||||
|
@ -4291,6 +4291,7 @@ fu_engine_get_result_from_component(FuEngine *self,
|
||||
g_autoptr(FuDevice) dev = NULL;
|
||||
g_autoptr(FwupdRelease) rel = NULL;
|
||||
g_autoptr(GError) error_local = NULL;
|
||||
g_autoptr(GError) error_reqs = NULL;
|
||||
g_autoptr(GPtrArray) provides = NULL;
|
||||
g_autoptr(GPtrArray) tags = NULL;
|
||||
g_autoptr(XbNode) description = NULL;
|
||||
@ -4327,6 +4328,8 @@ fu_engine_get_result_from_component(FuEngine *self,
|
||||
fu_device_set_version_raw(dev, fu_device_get_version_raw(device));
|
||||
fu_device_set_version_format(dev, fu_device_get_version_format(device));
|
||||
fu_device_set_version(dev, fu_device_get_version(device));
|
||||
} else {
|
||||
fu_device_inhibit(dev, "not-found", "Device was not found");
|
||||
}
|
||||
|
||||
/* add GUID */
|
||||
@ -4355,10 +4358,12 @@ fu_engine_get_result_from_component(FuEngine *self,
|
||||
request,
|
||||
task,
|
||||
FWUPD_INSTALL_FLAG_IGNORE_VID_PID,
|
||||
error))
|
||||
return NULL;
|
||||
&error_reqs)) {
|
||||
fu_device_inhibit(dev, "failed-reqs", error_reqs->message);
|
||||
/* continue */
|
||||
}
|
||||
|
||||
/* verify trust */
|
||||
/* verify trust */
|
||||
#if LIBXMLB_CHECK_VERSION(0, 2, 0)
|
||||
query = xb_query_new_full(xb_node_get_silo(component),
|
||||
"releases/release",
|
||||
|
Loading…
Reference in New Issue
Block a user