Commit Graph

114 Commits

Author SHA1 Message Date
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
Richard Hughes
2dadd09cb1 Optionally delay the device removal
In the case where we can trigger the replug automatically we can have to wait
for a USB re-enumeration (typically a few hundred ms) but when the user is
requred to unplug, and then replug we have to wait a bit longer.

The 'remove delay' allows us to modify per-device the removal delay. In the
case the device does not show back up in the correct time the device will be
auto-removed and the session will get a DeviceRemoved signal. In the case where
the device in bootloader mode shows up within the timeout the session just gets
a DeviceChanged event.

For the duration of the delayed removal the flags for the device are set to
zero to ensure the session does not try to interact with the device whilst
re-enumerating.
2017-11-24 14:42:27 +00:00
Richard Hughes
b6f79556f1 Use a SHA1 hash for the internal DeviceID
It's actually less scary to see a SHA1 hash than it is to see a path like
/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.2. It's also way easier to
copy and paste into the various fwupdmgr command that require a device ID and
also means we can match a partial prefix much like git allows.

If we also move to a model where plugins can be changed during different stages
of the update (e.g. during detach) then the device might change connection type
and then the sysfs path not only becomes difficult to paste, but incorrect.

Session software doesn't care about the format of the device ID (it is supposed
to be an implementation detail) and so there's no API or ABI break here. A few
plugins also needed to be ported, but nothing too worrying.
2017-11-16 07:18:36 +00:00
Richard Hughes
4eada34d4c trivial: Fix up introspection issues in the daemon code 2017-10-05 10:32:05 +01:00
Richard Hughes
cc3de2efa4 Do not store the newest release as part of the FuDevice object 2017-09-15 14:12:18 +01:00
Richard Hughes
68982c6624 Make FuDevice derive from FwupdDevice rather than FwupdResult
We're aiming for a model where devices can have multiple releases and we can
nuke FwupdResult completely.
2017-09-15 14:12:18 +01:00
Richard Hughes
27e5df2fe7 trivial: Fix a tiny leak in the daemon 2017-09-14 11:28:50 +01:00
Richard Hughes
9dde04fbda trivial: Split out some functionality not to be used by plugins 2017-09-13 14:59:32 +01:00
Richard Hughes
6fae095fe5 trivial: Less whitespace in the output of fu_device_to_string() 2017-09-11 10:29:52 +01:00
Richard Hughes
19ff7b9571 trivial: Add fu_device_to_string()
This allows us to easily print the FwupdDevice, the FwupdRelease and the
daemon-specific metadata. This can only be called from the daemon or plugins.
2017-09-04 13:27:48 +01:00
Richard Hughes
55566b53e6 Allow plugins to set boolean and integer metadata
Handling this in one place prevents plugins setting different values for
non-string values like TRUE/false or with different ways to represent integers.
2017-08-25 09:22:05 +01:00
Richard Hughes
1642b3b95a Deprecate the old FwupdResult API
It will be removed next time we bump soname.
2017-06-05 17:41:11 +01:00
Richard Hughes
ce38d94d5e trivial: Get rid of useless internal-only gtk-doc markup 2016-06-29 11:25:25 +01:00
Richard Hughes
043bc15f6d Allow metainfo files to match only specific revisions of devices
For example, matching on the 'USB\VID_0000&PID_0000&REV_0000' GUID rather than
the 'USB\VID_0000&PID_0000' GUID.

This is now possible as we can specify multiple GUIDs for a device.
2016-05-17 18:46:25 +01:00
Richard Hughes
feb8965d2e Add fu_device_get_alternate()
This daemon-only method allows a provider to associate one device with another.

Inspired by a patch by Mario Limonciello <mario_limonciello@dell.com>.
2016-05-17 16:27:59 +01:00
Richard Hughes
f76956be6f Make the device display name nicer 2016-04-15 09:02:28 +01:00
Richard Hughes
8e9762d174 Use libfwupd inside the daemon
This also entailed writing some compat defines to work on FuDevices without
casting each one to a FwupdResult.
2016-03-17 10:14:17 +00:00
Richard Hughes
1d96633198 Add 'Created' and 'Modified' properties on managed devices
This allows us to show suitable UI in GNOME Software when reporting historical
firmware updates.
2016-01-27 13:25:45 +00:00
Richard Hughes
b1b59d83cb Do not misdetect different ColorHug devices
Allow devices to have a specific device ID, which also matches other equivalent
IDs from other providers

This allows the user to plug in one type of device, and not match a different
cached device that also matches the same provider.
2016-01-06 13:20:58 +00:00
Richard Hughes
46832432ea Raise the dep on GLib to support and use g_autoptr() 2015-09-11 13:43:15 +01:00
Richard Hughes
d7dba98e68 Move boolean properties on the device to a set of flags
This is much less boilerplate and allows us to expand in the future.
2015-05-05 16:02:20 +01:00
Richard Hughes
f910ac9541 trivial: Also export the status enum codes 2015-03-19 10:54:06 +00:00
Richard Hughes
0e883ee815 Add and document the offline-update lifecycle
Also allow providers to override getting and clearing the last update status.
2015-03-19 10:31:23 +00:00
Richard Hughes
bbac6d7932 Return some more fields when returning data about firmware files 2015-03-12 11:41:20 +00:00
Richard Hughes
1b5ea3517d Add an OnlyOffline property for devices that cannot do online updates 2015-03-04 22:30:12 +00:00
Richard Hughes
1ffde6cd72 Return the device properties when calling GetDevices()
This allows us to discover a version number, and other things.
2015-03-02 22:44:58 +00:00
Richard Hughes
8dbfb1c478 Add initial build files and enough code to launch a simple D-Bus daemon 2015-02-26 18:16:40 +00:00