Commit Graph

13 Commits

Author SHA1 Message Date
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
Richard Hughes
8653e70480 trivial: Remove G_BEGIN_DECLS from all private headers 2019-10-09 20:02:16 +01:00
Richard Hughes
2d3287a231 Use G_BEGIN_DECLS correctly for internal headers 2019-02-10 17:33:20 +00:00
Richard Hughes
bfd946e463 Use '#pragma once' to avoid a lot of boilerplate 2019-02-09 08:42:30 -06:00
Richard Hughes
c125ec02ed Clarify what the platform ID actually is by renaming it
It wasn't hugely clear what the platform ID was actually meant to represent. In
some cases it was being used like a physical ID, in others it was a logical ID,
and in others it was both. In some cases it was even used as a sysfs path.

Clear up all the confusion by splitting the platform ID into two parts, an
optional *physical* ID to represent the electrical connection, and an optional
*logical* ID to disambiguate composite devices with the same physical ID.

Also create an explicit sysfs_path getter for FuUdevDevice to make this clear.

This allows WAIT_FOR_REPLUG to always work, rather than depending on the order
that the GUIDs were added, and that the kernel would always return the same
sysfs path (which it doesn't have to do, especially for hidraw devices).
2018-09-06 16:22:46 +01:00
Richard Hughes
3a8d532855 Allow the device list to take care of waiting for the device replug
This means that individual plugins do not have to manage thier own GUsbDevice
lifecycle and no longer have to call g_usb_context_wait_for_replug().
2018-08-31 16:41:40 +01:00
Richard Hughes
bb764e99a0 trivial: Add fu_device_list_get_by_platform_id() 2018-08-26 19:38:58 +01:00
Richard Hughes
02c90d8a03 Remove the unused Emacs indenting headers from all source files
Fixes https://github.com/hughsie/fwupd/issues/636
2018-08-09 12:48:04 +01:00
Mario Limonciello
51308e648a Adjust all licensing to LGPL 2.1+ (Closes: #526) 2018-05-29 09:03:13 +01:00
Richard Hughes
4012754569 trivial: Rename some FuDeviceList methods
The convention we're using is that find() returns the FuDeviceItem and get()
returns the FuDevice, so be consistent.

No code flow changes.
2018-01-16 13:48:51 +00:00
Richard Hughes
fbcebe096b Connect the progress and status callbacks on the new FuDevice on replug
This ensures we get progress events when replugging a device. Also, remove the
callbacks on the 'old' device to avoid causing multiple events on a 2nd-replug.
2017-12-11 16:48:56 +00:00
Richard Hughes
70425fe923 Allow different plugins to claim the same device
When changing from runtime->bootloader->runtime the usual way of handling this
in a fwupd plugin is to:

* reset the device and wait for a replug
* flash the hardware
* reset the device and wait for a replug

This works well when the runtime and bootloader modes are handled by the same
plugin. For situations like the Nitrokey device, where one plugin handles the
runtime (nitrokey), and another handles the bootloader (dfu) we have to have
the ability to 'ignore' the device removal and just issue a 'changed' signal
so the client refreshes the properties.
2017-11-24 14:42:27 +00:00
Richard Hughes
0a7e783cdd trivial: Move the device list to a new object
This moves more functionality out of the engine, and will allow us to add some
cleverness to the device list to allow the FuDevice to be shared between
different plugins.
2017-11-24 14:42:27 +00:00