From 106de6f3fbe0570e699e095d85f4effaa1a2343e Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 20 Feb 2023 11:22:52 +0000 Subject: [PATCH] Allow using requirements with no parent In this context a depth of 0 with no siblings means 'an only child' which in practice means 'the device itself'. --- src/fu-engine.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/fu-engine.c b/src/fu-engine.c index c01f864a0..c8e6c657d 100644 --- a/src/fu-engine.c +++ b/src/fu-engine.c @@ -1922,13 +1922,19 @@ fu_engine_check_requirement_firmware(FuEngine *self, FuDevice *child = NULL; FuDevice *parent = fu_device_get_parent(device_actual); GPtrArray *children; + + /* no parent, so look for GUIDs on this device */ if (parent == NULL) { - g_set_error(error, - FWUPD_ERROR, - FWUPD_ERROR_NOT_SUPPORTED, - "No parent specified for device %s", - fu_device_get_name(device_actual)); - return FALSE; + if (!fu_device_has_guids_any(device_actual, guids)) { + g_set_error(error, + FWUPD_ERROR, + FWUPD_ERROR_NOT_SUPPORTED, + "No GUID of %s on self device %s", + xb_node_get_text(req), + fu_device_get_name(device_actual)); + return FALSE; + } + return TRUE; } children = fu_device_get_children(parent); for (guint i = 0; i < children->len; i++) {