fwupd/src/fu-device-list.h
Richard Hughes 81f9552095 Correctly order devices when using logical parents
If the device parent is added using fu_device_add_parent_guid() or ParentGuid
from a quirk file then the child is not returned in fu_device_get_children() by
design as the physical ID will be likely different.

This means we cannot reliably 'depsolve' the order in FuDevice as we need the
full list of devices that might be parents. The existing algorithm had several
logical problems when dealing with more than a single parent and child.

The FuDeviceList object is the right place to do this as it knows about all
added devices on the system.

This means the addition of a logical device causes the root logical device
(and all it's children, and grandchildren) to be re-ordered. This allows
firmware on deeply nested composite devices like hubs to be installed in the
correct order.
2020-09-14 10:13:33 -05:00

36 lines
1.1 KiB
C

/*
* Copyright (C) 2017 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include <glib-object.h>
#include "fu-device.h"
#define FU_TYPE_DEVICE_LIST (fu_device_list_get_type ())
G_DECLARE_FINAL_TYPE (FuDeviceList, fu_device_list, FU, DEVICE_LIST, GObject)
FuDeviceList *fu_device_list_new (void);
void fu_device_list_add (FuDeviceList *self,
FuDevice *device);
void fu_device_list_remove (FuDeviceList *self,
FuDevice *device);
GPtrArray *fu_device_list_get_all (FuDeviceList *self);
GPtrArray *fu_device_list_get_active (FuDeviceList *self);
FuDevice *fu_device_list_get_old (FuDeviceList *self,
FuDevice *device);
FuDevice *fu_device_list_get_by_id (FuDeviceList *self,
const gchar *device_id,
GError **error);
FuDevice *fu_device_list_get_by_guid (FuDeviceList *self,
const gchar *guid,
GError **error);
gboolean fu_device_list_wait_for_replug (FuDeviceList *self,
FuDevice *device,
GError **error);
void fu_device_list_depsolve_order (FuDeviceList *self,
FuDevice *device);