mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-06 11:07:37 +00:00
trivial: Copy the parent vendor when adding child devices
This commit is contained in:
parent
4f70833832
commit
df2b450b74
@ -249,6 +249,12 @@ fu_device_add_child (FuDevice *device, FuDevice *child)
|
||||
}
|
||||
g_ptr_array_add (priv->children, g_object_ref (child));
|
||||
|
||||
/* copy from main device if unset */
|
||||
if (fu_device_get_vendor (child) == NULL)
|
||||
fu_device_set_vendor (child, fu_device_get_vendor (device));
|
||||
if (fu_device_get_vendor_id (child) == NULL)
|
||||
fu_device_set_vendor_id (child, fu_device_get_vendor_id (device));
|
||||
|
||||
/* ensure the parent is also set on the child */
|
||||
fu_device_set_parent (child, device);
|
||||
}
|
||||
|
@ -183,6 +183,7 @@ fu_engine_device_parent_func (void)
|
||||
/* parent */
|
||||
fu_device_set_id (device2, "parent");
|
||||
fu_device_add_guid (device2, "parent-GUID");
|
||||
fu_device_set_vendor (device2, "oem");
|
||||
|
||||
/* add another child */
|
||||
fu_device_set_id (device3, "child2");
|
||||
@ -196,6 +197,8 @@ fu_engine_device_parent_func (void)
|
||||
/* verify both children were adopted */
|
||||
g_assert (fu_device_get_parent (device3) == device2);
|
||||
g_assert (fu_device_get_parent (device1) == device2);
|
||||
g_assert_cmpstr (fu_device_get_vendor (device3), ==, "oem");
|
||||
g_assert_cmpstr (fu_device_get_vendor (device1), ==, "oem");
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user