Commit Graph

114 Commits

Author SHA1 Message Date
Mario Limonciello
a90dba7ab2 trivial: Copy the version format from donor devices 2019-04-09 08:31:45 +01:00
Richard Hughes
dce91204c9 Fix some typos spotted using codespell 2019-04-08 12:47:53 +01:00
Richard Hughes
2da42d3cd4 trivial: Add fu_device_set_firmware_size()
This allows us to set the value where the blob has to be a specific size.
2019-03-21 10:31:35 +00:00
Richard Hughes
4c6d61dc3a trivial: Add fu_device_get_firmware_size_min() 2019-03-21 10:27:08 +00:00
Mario Limonciello
96a0dd5606 Add a support for delayed activation
This is intended for devices that it is not safe to immediately activate
the firmware.  It may be called at a more convenient time instead.

Both fwupdmgr and fwupdtool support the feature.

- if called at runtime with fwupdmgr it uses the daemon
- during shutdown fwupdtool uses the pending.db to perform this feature.
2019-02-27 09:04:54 +00:00
Richard Hughes
db4523d698 Convert all child instance IDs when converting the parent 2019-02-12 10:16:42 -06:00
Richard Hughes
c909ab3f3c unifying: Fix regression when recovering from failed flash
The unifying version numbers are of the form 'RQR24.00_B0000' which means we
have to force the plugin to 'plain' version format to avoid stripping out the
non-semver chars.

Fixes https://github.com/hughsie/fwupd/issues/1018
2019-02-12 10:00:02 +00:00
Richard Hughes
237e842e7c Fix a regression in using the InstanceIDs for quirk matching
Fixes https://github.com/hughsie/fwupd/issues/1007
2019-02-07 18:56:15 +00:00
Richard Hughes
6b78d64987 Add fwupd_guid_from_string() to drop dep on uuid
This also allows us to write mixed-endian structures and adds tests. As part of
this commit we've also changed the API of something that's not yet been in any
tarball release, so no pitchforks please.
2019-02-06 14:48:04 +00:00
Richard Hughes
1bc432316a Defer the InstanceID->GUID hashing until after setup
This allows hardware from OEMs to *not* match generic firmware supplied by the
device manufacturer. The idea being, that the OEM will supply firmware that
will actually work on the device.

Based on a patch from Mario Limonciello, many thanks.
2019-02-06 08:02:16 +00:00
Richard Hughes
65c81921b6 Add fu_device_add_instance_id() and prefer explicit conversion 2019-02-04 15:19:57 +00:00
Richard Hughes
b8c0a279ca trivial: Remove a ton of daemon debugging now the Instance IDs are available 2019-02-04 15:19:57 +00:00
Richard Hughes
297055c9d8 Report the DeviceInstanceIDs to fwupdmgr get-updates
This makes it much easier to write metainfo files as we don't have to ask OEMs
or ODMs to run fwupdtool or fwupd with --verbose and then sort through hundreds
of debugging statements.

The fwupdmgr get-devices output also now prints output like this:

    20EQS64N0C System Firmware
      Guid:                 ddc0ee61-e7f0-4e7d-acc5-c070a398838e
      Guid:                 40ce5954-bfa8-5762-926b-f4848cb28bc8 <- UEFI\RES_{DDC0EE61-E7F0-4E7D-ACC5-C070A398838E}

We're deliberately not showing the InstanceId lines in the get-updates command
as the instance IDs are not useful in this case. It will also only show the
InstanceID lines when run as a trusted user, for instance root.
2019-02-04 15:19:57 +00:00
Richard Hughes
592baedfff Export some of the GUID functionality 2019-02-04 15:19:57 +00:00
Mario Limonciello
7a3df4bb07 fu-tool: Show UpdateMessage if applicable for install command
When calling with a CAB as an install argument, this needs to be
manually populated since the release won't be built.
2019-01-31 13:54:01 -06:00
Richard Hughes
55b8a249e0 Sanitize the version if the version format has been specified
This converts versions like 'v1.2.3' into a valid semver of '1.2.3' if the
version format has been set.

Fixes https://github.com/hughsie/fwupd/issues/884
2018-12-05 07:07:35 -06:00
Richard Hughes
596f93f50b trivial: Allow calling fu_device_has_guid() with non-GUID text
This matches the behaviour of fu_device_add_guid().
2018-11-28 17:53:21 +00:00
Richard Hughes
ac458d3436 Guess the version format when it is not provided
The most important change here is that versions without dots (not a 'semver')
are treated as 'PLAIN' rather than 'UNKNOWN'.
2018-11-14 11:52:46 +00:00
Richard Hughes
cdcd6a2423 trivial: Add VersionFormat to the fu_device_to_string() output 2018-10-18 19:31:04 +01:00
Richard Hughes
a3d5712b9f Allow setting the version format from a quirk entry 2018-10-11 07:54:01 +01:00
Richard Hughes
83e56c1a6c Don't use AppStream-glib for string helpers 2018-10-11 07:54:01 +01:00
Richard Hughes
d3d2c2c39f Don't use AppStream-glib for the GUID helpers
Long term we want to wean ourselves away from libappstream-glib.
2018-10-11 07:54:01 +01:00
Richard Hughes
be78d0f0ce trivial: Remove unused header 2018-10-11 07:54:01 +01:00
Mario Limonciello
f20f9f65bc fu-device: Ensure that parent ID is created before creating quirked children 2018-10-10 16:24:18 -05:00
Mario Limonciello
7c10696690 Add support for devices to show an estimated flash time (Closes: #765)
This time is provided to frontends to be able to show estimates
before a user would agree to flash the device.
2018-09-26 11:35:59 +01:00
Richard Hughes
37d0943844 Add FuMutex helper to make various parts of the daemon thread-safe 2018-09-12 16:10:38 +01:00
Richard Hughes
b08e7bc7aa trivial: Set a log domain for each file
This allows us to do something like:

G_MESSAGES_DEBUG=FuEngine ./src/fwupd
2018-09-11 18:59:05 +01:00
Richard Hughes
1513585d21 trivial: Move the poll setup into common code
This is used by two device types in the unifying plugin, and soon to be one
other new plugin.
2018-09-09 13:43:18 +01:00
Richard Hughes
841c1807e1 trivial: Copy the parent if set for the repluged device
Based on a patch from Mario Limonciello, many thanks.
2018-09-07 15:32:32 +01:00
Mario Limonciello
0307a0a843 trivial: fu-device: don't show messages with (null) for device ID
device ID might not yet be initialized, so just show the word
"unknown"
2018-09-07 09:13:14 +01:00
Mario Limonciello
e3016602f8 Include serial number in daemon device output when trusted
This moves the storing of the serial number into the daemon and
when the calling process is UID 0 includes it in device output
2018-09-06 13:34:28 -05: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
afa5ee75ec trivial: Run FuDevice:probe() when adding children
Probe does not require the device to be open and can be used automatically.
2018-09-05 13:32:26 +01:00
Mario Limonciello
b172fb8f63 fu-device: Add platform ID after creating GUID for children
This fixes issues where the child gets the same ID as the parent.
2018-09-04 21:43:50 +01:00
Richard Hughes
e39801f00d trivial: Fix some NULL/FALSE confusion 2018-09-04 20:37:17 +01:00
Richard Hughes
8878f1094e trivial: Modernize FuDevice to use 'self' as the instance name 2018-09-04 08:22:39 -05:00
Richard Hughes
828c039c00 trivial: Fix up some gtk-doc warnings 2018-09-04 08:22:39 -05:00
Richard Hughes
90479d54c8 trivial: Add a FuDevice:incorporate() vfunc
This allows classes that inherit from FuDevice to copy across private data.
2018-09-04 08:22:39 -05:00
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