From d09f083e4a09dd800cf374c67cccf5752b3b6c33 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 14 Apr 2020 15:44:19 +0100 Subject: [PATCH] Prefer to update the child first if the order is unspecified This fixes updating VLI hardware where there are multiple 'tiers' of USB hubs. --- libfwupdplugin/fu-device.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libfwupdplugin/fu-device.c b/libfwupdplugin/fu-device.c index 32e929bf0..2b381933e 100644 --- a/libfwupdplugin/fu-device.c +++ b/libfwupdplugin/fu-device.c @@ -643,6 +643,13 @@ fu_device_set_parent (FuDevice *self, FuDevice *parent) g_return_if_fail (FU_IS_DEVICE (self)); + /* if unspecified, always child before parent */ + if (parent != NULL && + fu_device_get_order (parent) == fu_device_get_order (self)) { + g_debug ("auto-setting %s order", fu_device_get_id (parent)); + fu_device_set_order (parent, fu_device_get_order (self) + 1); + } + if (priv->parent != NULL) g_object_remove_weak_pointer (G_OBJECT (priv->parent), (gpointer *) &priv->parent); if (parent != NULL)