Show the device parent if there is an interesting child

Fixes https://github.com/fwupd/fwupd/issues/1671
This commit is contained in:
Richard Hughes 2020-01-06 14:02:38 +00:00
parent 30ef455d50
commit 95c7876346

View File

@ -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;
}