From 95c787634663bc1d8f85430bcfcb6a963ab844e3 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 6 Jan 2020 14:02:38 +0000 Subject: [PATCH] Show the device parent if there is an interesting child Fixes https://github.com/fwupd/fwupd/issues/1671 --- src/fu-util-common.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/fu-util-common.c b/src/fu-util-common.c index 22ae7c40f..2fb819f4d 100644 --- a/src/fu-util-common.c +++ b/src/fu-util-common.c @@ -218,6 +218,18 @@ fu_util_print_tree (GNode *n, gpointer data) fu_util_traverse_tree, data); } +static gboolean +fu_util_is_interesting_child (FwupdDevice *dev) +{ + GPtrArray *children = fwupd_device_get_children (dev); + for (guint i = 0; i < children->len; i++) { + FwupdDevice *child = g_ptr_array_index (children, i); + if (fu_util_is_interesting_device (child)) + return TRUE; + } + return FALSE; +} + gboolean fu_util_is_interesting_device (FwupdDevice *dev) { @@ -228,6 +240,8 @@ fu_util_is_interesting_device (FwupdDevice *dev) /* device not plugged in, get-details */ if (fwupd_device_get_flags (dev) == 0) return TRUE; + if (fu_util_is_interesting_child (dev)) + return TRUE; return FALSE; }