Commit Graph

76 Commits

Author SHA1 Message Date
Mario Limonciello
3588cd0e06 Copy over parent GUIDs from other plugin donors
The proxy registration was losing this detail so Dell docks were not
setting this properly for child devices.
2018-09-04 10:00:52 +01:00
Mario Limonciello
64c905b1f3 Remove children of devices when the parent is removed 2018-09-04 10:00:52 +01:00
Richard Hughes
1263446b23 trivial: Add a 'setup' vfunc that is used after open()
The setup() is the counterpart to probe(), the difference being the former needs
the device open and the latter does not.

This allows objects that derive from FuDevice, and use FuDeviceLocker to use
open() and close() without worrying about the performance implications of
probing the hardware, i.e. open() now simply opens a file or device.
2018-09-03 19:56:26 -05:00
Richard Hughes
3f3aba2530 trivial: Do not call probe() for every open()+close() cycle
Probe is supposed to be used to check things like the VID and PID, and to
optionally add extra GUIDs to the device. Crucially, it doesn't require open()
to operate, and so it's wrong to reprobe() on calling close().
2018-09-03 19:56:26 -05:00
Richard Hughes
8f0695c762 trivial: Allow setting the VendorID from a quirk 2018-09-03 07:18:36 -05:00
Mario Limonciello
4631bd7f21 trivial: fu-device: Downgrade warnings about overwiting same name to debug
Commit 0f72ef2f88 causes probe to be re-run on FuDevices.
Any devices derived from FuUsbDevice that set the "Name" key will have the
quirks re-evaluated when GUIDs are added again leading to warnings like this:

```
(fwupdtool:8259): Fu-WARNING **: 23:04:43.144: device 970e85c8400ed95ec5c02b86e52a0ca4ce6fc051 overwriting same name value: Dell USB hub
```
2018-09-01 08:33:08 -05:00
Richard Hughes
0f72ef2f88 trivial: Invalidate the probe if the FuDevice is closed
For DFU it is important to re-get the interfaces and list of quirks when
switching from runtime -> bootloader -> runtime.
2018-08-30 16:55:41 +01:00
Richard Hughes
838d91e4ed Add support for counterpart GUIDs
These are GUIDs that are related to the main device, but should not be used for
quirk matching. For instance, we might want to list the GUIDs for a bootloader
mode, but we don't want to import all the quirks for the bootloader when in the
runtime mode.
2018-08-30 16:55:41 +01:00
Richard Hughes
50d6bd10bd trivial: Add refcounting to fu_device_open() 2018-08-29 19:12:29 +01:00
Richard Hughes
23170a8195 trivial: Set the plugin name when the GUID is added 2018-08-29 14:27:57 +01:00
Richard Hughes
168a209a14 trivial: Add a vfunc for setting the quirk KVs in derived objects 2018-08-29 14:27:57 +01:00
Richard Hughes
163947bd5f Improve performance when reading keys from the quirk database
Rather than guessing the keys that might be present, and doing two hash lookups
for each, get the key values in one call. This is somewhat more performant, and
allows us to do clever things in the future.
2018-08-29 14:27:57 +01:00
Richard Hughes
a417d6c82a trivial: Allow setting the firmware min and max sizes from quirk files 2018-08-28 18:30:00 +01:00
Richard Hughes
bda4d81d3d trivial: Allow plugins to add virtual children from quirk files
The example here would be adding virtual i2c devices attached to an existing
USB hub device.
2018-08-28 18:30:00 +01:00
Richard Hughes
96fa7d9f49 trivial: Allow devices to set the parent GUID from a quirk entry 2018-08-28 18:30:00 +01:00
Richard Hughes
6dec401a67 Store the DeviceInstanceId as a GUID in the quirk database
This allows us to match non-DeviceID GUIDs, and also GUIDs we don't know how to
generate.

To make this fully useful, search for device quirks when GUIDs are added.
2018-08-28 18:30:00 +01:00
Richard Hughes
73bf2337c1 trivial: Add fu_common_strtoull() as a shared function 2018-08-28 09:41:10 +01:00
Richard Hughes
07ed2f00fa trivial: Use the new subclassed device methods
This just reduces our API surface a little, no behaviour change.
2018-08-24 21:48:59 +01:00
Richard Hughes
2d9ba8d1a3 trivial: Don't include the default GUID in the device ID if NULL 2018-08-23 09:47:28 +01:00
Richard Hughes
61eb20d194 trivial: Fix a gtk-doc typo 2018-08-22 14:03:23 +01:00
Richard Hughes
c0fe556350 Add more common vfuncs to FuDevice
This allows us to abstract out common code for plugins not using FuUsbDevice.
2018-08-22 13:32:29 +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
Richard Hughes
81c427ca6d Allow different plugins to add the same device
In this instance, we define the 'same device' to be a FuDevice that has at
least one matching GUID. We allow the plugins to define which one is 'better'
than other plugins, and use this to only have one FuDevice for the physical
device.

Alternative to https://github.com/hughsie/fwupd/pull/604
2018-08-06 21:58:28 -05:00
Richard Hughes
ca851f5ab4 trivial: Add fu_device_incorporate()
This allows us to copy properties from a donor object.
2018-06-28 15:51:11 +01:00
Richard Hughes
c43a9e9024 trivial: Fix the Since lines for the equivalent_id functions 2018-06-28 15:51:11 +01:00
Richard Hughes
9ecde4a38a trivial: Allow setting standard FwupdDeviceFlags when getting quirk data 2018-06-28 12:08:01 +01:00
Richard Hughes
ac11be65f3 trivial: Add fu_device_has_custom_flag()
This splits the custom flags and checks if one of them exists.
2018-06-28 12:07:13 +01:00
Richard Hughes
63b173046d trivial: Rename the 'plugin-hints' functionality to 'custom-flags'
They will be used as actual flags in the future.
2018-06-28 12:07:13 +01:00
Richard Hughes
e48351e260 Set the alternate device ID, not the object itself
If the daemon either de-duplicates or replaces the object passed emitted from
device-added then the object set as the alternate may not be the same instance
as the daemon version. This causes weird things to happen.

To make this less fragile, specify the *ID* of the object that should be the
alternate device, which allows the daemon to do clever things, and then assign
the object from the ID as the last step.

Although fixing no bug, this makes implementing future functionality easier.
2018-06-22 13:28:27 +01:00
Mario Limonciello
5a8581e4e7 trivial: Correct the install task ordering
With some instrumented testing I was finding that without
FWUPD_DEVICE_FLAG_INSTALL_PARENT_FIRST being set that the parent
was installing first.
2018-06-14 16:09:57 -05:00
Mario Limonciello
51308e648a Adjust all licensing to LGPL 2.1+ (Closes: #526) 2018-05-29 09:03:13 +01:00
Richard Hughes
988e73c414 uefi: Search all available GUIDs when matching hardware
Using just the default GUID is fragile and might break if the GUIDs get added
in the 'wrong' order or if the GUID list is sorted.

Fixes https://github.com/hughsie/fwupd/issues/518
2018-05-19 23:07:40 +01:00
Richard Hughes
3e3ac27216 trivial: Add attach() and detach() vfuncs to FuDevice 2018-05-18 10:08:10 +01:00
Richard Hughes
c48d0cfa0c trivial: Add a read_firmware() vfunc to FuDevice 2018-05-14 17:07:20 +01:00
Richard Hughes
0a0483b2ce trivial: Add a write_firmware() vfunc to FuDevice 2018-05-14 17:07:20 +01:00
Richard Hughes
9f86ade6bf Allow plugins to define the order composite firmwares are installed 2018-05-12 20:46:02 +01:00
Richard Hughes
df2b450b74 trivial: Copy the parent vendor when adding child devices 2018-05-03 19:58:04 +01:00
Richard Hughes
5e447293fa Add the concept of logical mappings between different devices
This allows us to find out the logical parent device, for instance in composite
devices with more than one firmware image for a single device.

We also allow lazily specifying the device parent using a GUID and the engine
then automatically sets the parent object when the GUIDs match, which allows
children and parents to exist in different plugins.
2018-05-03 08:07:04 +01:00
Richard Hughes
1a24d9da90 Include the device VID and PID in the calculation of the device-id
If we plug in USB device A, remove it, plug in USB device B and get the same
autogenerated string all kinds of nasty things happen to the history database.
2018-02-01 14:01:50 +00:00
Richard Hughes
6b0e5c4f21 Fix a daemon warning when using fwupdmgr get-results
The FwupdRelease needs to be manually added in some circumstances.
2018-01-28 21:51:41 +00:00
Richard Hughes
bc3a4e1f57 Store firmware update success and failure to a local database
Rename FuPending to FuHistory to better represent what the object is now doing.
Also, while we're here, switch to using SQLite prepared statements to avoid a
possible invalid read on i386 hardware.
2018-01-11 09:59:34 +00:00
Richard Hughes
306c15b3a0 Add quirks based on the device GType
This allows us to have one per-plugin device quirk without having to call
fu_quirks_lookup_by_usb_device() in each plugin.
2017-12-11 10:47:18 +00:00
Richard Hughes
5060246526 trivial: Move the USB quirks from FuPlugin to FuUsbDevice
Also rename some general USB quirks that are not specific to any one plugin.
2017-12-11 10:47:18 +00:00
Richard Hughes
a29711c4a1 Move the FuQuirks reference down from DfuDevice to FuDevice 2017-12-11 10:47:18 +00:00
Richard Hughes
024cc230ed Add fu_device_set_progress_full()
This allows the plugin to use the raw byte values as a progress counter without
first converting to a percentage.
2017-12-08 09:36:57 +00:00
Richard Hughes
fa34bcffa3 trivial: Add a to_string() vfunc for any objects subclassing FuDevice 2017-12-08 09:36:57 +00:00
Richard Hughes
55f8f236a9 trivial: Allow setting the platform-id from the object constructor 2017-12-08 09:36:57 +00:00
Richard Hughes
4a036018f7 Set the progress and state on the FuDevice, not the FuPlugin
This makes more sense; we're updating the device, not the plugin itself.

This also means we don't need to funnel everything through callbacks like
GFileProgressCallback and we can also update the state without adding an
explicit callback to each derived device type.
2017-11-30 20:51:52 +00:00
Richard Hughes
909d556c03 Get the serial number from USB devices
This is currently unused.
2017-11-30 14:16:34 +00:00
Richard Hughes
3e1da8f9b8 Do not hardcode the device name when not required
If we're getting it from a USB descriptor we don't also need to hardcode it.
2017-11-27 18:07:53 +00:00