Commit Graph

315 Commits

Author SHA1 Message Date
Mario Limonciello
e2b8a2797e Skip cleanup after device is done updating if will-disappear is set (Fixes: #1529)
This fixes a regression introduced by 2031ce3bf6
that leads to:
```
USB error on device 2dc8:5750 : No such device (it may have been disconnected) [-4]
```
2019-11-14 08:06:17 -06:00
Mario Limonciello
f5605532e5 trivial: fu-plugin: only show an error once
"failed to open plugin" was being prefixed twice
2019-11-05 15:36:55 -06:00
Mario Limonciello
2e06dcd5e3 trivial: 8bitdo: set a transient failure while waiting for user action 2019-11-01 14:31:03 +00:00
Richard Hughes
0bbef29d3e Always report the update-error correctly for multiple updates
The root of this problem is that we were trying to use pending.db as both a
pending report store and also a record of history, so you could see updates for
device foo 1.2.3->1.2.4 and then 1.2.4->1.2.5.
This sort-of half worked, but it meant in some cases we matched on the old
device version, sometimes on the new release version and sometimes matching on
either.

The problem was that in various places we were using the device ID as *the*
primary key, and so we had various functions like fu_history_get_device_by_id()
that expected to return just one device, not several.

The device ID also changes if the device is moved from USB plug to another, and
so it got even more complicated again trying to de-dupe the devices.

The sanest thing to do is to decide that pending.db only contains the latest
attempt to go from one version to another using device-id as the primary key.
This makes reporting work reliably now, although has the effect you can't
report a 1.2.3->1.2.4 and 1.2.4->1.2.5 at the same time. Note, if you tried to
do the latter before, the update-error (if set) would be wrong on the second
report...

For the 1.3.3 release make it all simpler and so the reporting works reliably.
Longer term we can design a better database schema that uses unique ID to
represent the *transaction* itself, that isn't tied to the device ID in any way.
This might mean extending the DBus API to cope with multiple devices being
returned with the same device-id set.
2019-11-01 08:16:18 -05:00
Richard Hughes
ec14e4bdd0 trivial: Do not emit a warning if a child has no version number 2019-11-01 08:16:18 -05:00
Richard Hughes
45a1815587 trivial: Use the new possible_plugin support for USB devices too
This matches the UDEV device add, and was missed from the original commit due
to a failed rebase.

Fixes https://github.com/fwupd/fwupd/issues/1512
2019-10-30 10:49:00 -05:00
Richard Hughes
2031ce3bf6 Ensure the device is open when doing the subclassed prepare() and cleanup()
It's not usual to open the device from inside the device, otherwise there is a
possibility of a deadlock. For devices without the ->prepare() virtual function
the ->open() should either be a NOP or very fast indeed.
2019-10-30 09:44:52 -05:00
Richard Hughes
a58510b246 Allow verifying the device image itself from fwupdtool
To debug flashing failures it's sometimes requried to get a SPI dump of the
hardware to analysis.

Add a debug-only command that lets us dump the device from the engine.
2019-10-30 13:55:55 +00:00
Richard Hughes
51a869a01d Use XMLb to query quirks
During startup we do 1898 persistent allocations to load the quirk files, which
equates to ~90kb of RSS. Use libxmlb to create a mmap'able store we can query
with XPath queries at runtime.
2019-10-30 08:29:58 -05:00
Mario Limonciello
44b9e46d37 uefi: rework ESP path detection and lifecycle
This makes the daemon less destructive at startup, especially if the ESP
is not mounted.

It's stored in 3 different places right now, so move it into one point of truth.

Now the ESP is detected when needed including all point of time safety checks and
dynamically mounted and unmounted if necessary.
2019-10-24 15:22:01 -05:00
Richard Hughes
95c98a95b6 Allow fwupdtool to dump details of common firmware formats
To do this, the plugins have to register the GType(s) they are using for
firmware, along with a short 'id' that can be used in CLI scripts.
2019-10-22 12:36:15 -05:00
Richard Hughes
8fb2e6a881 trivial: Do not do system coldplug when using FU_ENGINE_LOAD_FLAG_NO_ENUMERATE 2019-10-22 12:36:15 -05:00
Mario Limonciello
0e500321d7 fu-engine: Check multiple plugins if quirks match
`ata` and `emmc` both have block devices and so they both need to
be checked
2019-10-18 14:18:09 -05:00
Richard Hughes
791c91be1e trivial: Increase verbosity when actually updating devices
As the plugin is allowed to change print out the entire FuDevice before
performing each step when in verbose mode.

Note, these are only show during update if run with --verbose, not at startup.
2019-10-17 14:06:27 +01:00
Richard Hughes
802bb313c6 trivial: Allow plugins to use WAIT_FOR_REPLUG in prepare and cleanup 2019-10-17 14:06:27 +01:00
Mario Limonciello
2a0e20bfaa trivial: fu-engine: Don't compare device and content checksums
Use `FWUPD_DEVICE_FLAG_CAN_VERIFY_IMAGE` to register that a content
checksum should be used.
2019-10-14 12:41:09 -05:00
Mario Limonciello
91d36095e1 fu-engine: Read all releases and convert versions when comparing
Fixes matching ESRT version to metadata version for UEFI
2019-10-14 12:41:09 -05:00
Mario Limonciello
8fa0b382fa Add new flags can-verify and can-verify-image
These are used to indicate that the device can verify checksums or
can dump an image for checksumming.
2019-10-14 12:41:09 -05:00
Mario Limonciello
e1b4d8ebcd Add a new device flag for indicating device won't come back
Devices like this can't be verified that the version was updated
until they're manually put into the correct mode by the user.
2019-10-12 14:07:34 -05:00
Richard Hughes
731875af86 Remove FU_PLUGIN_RULE_REQUIRES_QUIRK as all the plugins now use it 2019-10-09 20:02:16 +01:00
Richard Hughes
d8a8d5e776 Set all FuUdevDevice plugins to use FU_QUIRKS_PLUGIN
This speeds up startup as we're only calling fu_plugin_udev_device_added() on
plugins that can actually handle the device.
2019-10-09 20:02:16 +01:00
Mario Limonciello
d70260692f trivial: fu-engine: fix never reporting remotes
```
Uploading firmware reports helps hardware vendors to quickly identify failing and successful updates on real devices.
Upload report now? (Requires internet connection):
0.	Do not upload reports at this time, but prompt again for future updates
1.	Do not upload reports, and never ask to upload reports for future updates
2.	Upload reports just this one time, but prompt again for future updates
3.	Upload reports this time and automatically upload reports after completing future updates
1
key ReportUri not supported
```
2019-10-07 05:36:22 -05:00
Mario Limonciello
34c366aab2 Add support for automatically uploading reports 2019-09-30 16:21:23 -05:00
Richard Hughes
868db4e1a8 Export the instructions for detaching the device
Somewhat embarrassingly we were not actually showing the 8bitdo manual detach
images because... we were not actually exporting them. I don't know how this
ever worked in GNOME Software, but it would also explain the low 'success' rate
of the 8bitdo firmware on the LVFS.

This will also be used by Logitech in the future for the C1 Unifying devices.

To work in gnome-softare, this also needs the matching functionality to call
gs_app_add_screenshot() with the new exported data.
2019-09-26 16:40:12 +01:00
Richard Hughes
e37575192d Do not enumerate physical devices when running the internal self tests
We don't need to enumerate USB and UDev devices in the self tests. In the case
where the probe fails (due to a permissions error, as not running as root) we
don't want the tests to fail.
2019-09-25 04:49:52 -05:00
Richard Hughes
0917fb6aec Export the salted machine ID as a daemon property 2019-09-23 17:34:47 +01:00
Richard Hughes
0ad59cbc03 Support <issues> in AppStream metadata
When the LVFS switches over to outputting <issues> rather than appending to the
update description we need to be in a position to display the new data.
2019-09-17 13:48:44 +01:00
Mario Limonciello
20cc9eebc5 Try to only show DMI product name once
* libfwupd: export new property HostProduct
* clients: Use this property for setting the title of trees

Before:
```
○
├─XPS 13 7390 TPM 2.0:
│     Device ID:           c56e9f77cfee65151bdef90310776f9d62827f5a
│     Summary:             Platform TPM device
│     Current version:     7.2.1.0
│     Vendor:              Dell Inc.
│     Update Error:        Updating disabled due to TPM ownership
│     Flags:               internal|require-ac|registered
└─XPS 13 7390 System Firmware:
      Device ID:           b6c08fb9e5384d9d101853cc1ca20cf0ce2df2e2
      Current version:     0.1.1.1
      Minimum Version:     0.1.1.1
      Vendor:              Dell Inc.
      Flags:               internal|updatable|require-ac|registered|needs-reboot

```

After:
```
XPS 13 7390
│
├─TPM 2.0:
│     Device ID:           c56e9f77cfee65151bdef90310776f9d62827f5a
│     Summary:             Platform TPM device
│     Current version:     7.2.1.0
│     Vendor:              Dell Inc.
│     Update Error:        Updating disabled due to TPM ownership
│     Flags:               internal|require-ac|registered
└─System Firmware:
      Device ID:           b6c08fb9e5384d9d101853cc1ca20cf0ce2df2e2
      Current version:     0.1.1.1
      Minimum Version:     0.1.1.1
      Vendor:              Dell Inc.
      Flags:               internal|updatable|require-ac|registered|needs-reboot
```
2019-09-05 11:22:39 -05:00
Richard Hughes
f679e5efa8 Include the kernel release as a runtime version
Although not always useful (due to patches being backported) being able to
depend on a specific kernel version might save our bacon in the future.
2019-08-28 15:52:50 +01:00
Mario Limonciello
6ff8a16390 trivial: Adjust daemon device sorting
This should output devices by priority followed by name instead now.
2019-08-27 15:39:29 +01:00
Richard Hughes
5e952ce35f Add a ->udev_device_changed plugin vfunc
This allows plugins to rescan hardware based on uevents of any device class
registered with fu_plugin_add_udev_subsystem().

Additionally, the events are rate limited to avoid causing lots of extra plugin
processing when replugging hardware.
2019-08-26 13:55:55 +01:00
Mario Limonciello
263cab99e9 fu-engine/fu-config: Reload metadata store when configuration changes
Emit a signal from FuConfig object that is caught by FuEngine to
reload the store.

This should fix problems with Fedora CI failing.
2019-08-21 22:05:24 +01:00
Richard Hughes
aaf0ce788f Allow specifying <firmware>GUID</firmware> to check any version exists
If the version is not specified then treat it as just 'exists'.
2019-07-16 18:27:52 +01:00
Richard Hughes
4266ac4765 Add a specific error code for the low battery case
Users are getting confused when they're being told that AC power is required
when they are already on AC power... but the battery is too low to perform the
update.
2019-07-11 09:31:34 -07:00
Richard Hughes
3d00522dd3 Check if the system is offline during install, rather than at startup
This splits out the systemd functionality to a new file, but makes no other
logic changes.
2019-05-18 08:02:29 -07:00
Richard Hughes
5cbb5cf908 Allow using --force to trigger a duplicate offline update 2019-05-07 14:30:07 +01:00
Mario Limonciello
12a016b939 trivial: Only apply SmbiosManufacturer to release version for internal
External devices may not use the same VersionFormat.
2019-04-30 09:27:08 +01:00
Richard Hughes
5079f26f0e Never guess the version format from the version string
This leads to madness, as some formats are supersets of the detected types,
e.g. 'intel-me' is detected as 'quad' and 'bcd' is detected as 'pair'.

Where the version format is defined in a specification or hardcoded in the
source use a hardcoded enum value, otherwise use a quirk override.

Additionally, warn if the version does not match the defined version format
2019-04-30 09:25:41 +01:00
Richard Hughes
c84b36c541 Export the version-format to clients
This allows a vendor to verify the VersionFormat of a device without running
the daemon in verbose mode.
2019-04-30 09:25:41 +01:00
Mario Limonciello
253b825e6b fu-engine: Check if VersionFormat is ambiguous when adding devices
Set `UpdateError` in this case, and prevent updates.

If the `VersionFormat` is not known, then the device will later have
problems installing firmware with errors like:
```
failed to get release version: version format unset and version 13000001 ambiguous
```

or

```
Firmware version formats were different, device was '(null)' and release is 'plain'

```

This generally should be corrected by quirking the device.
2019-04-25 10:26:02 -05:00
Richard Hughes
7886c086a1 Don't upload reports when the user has configured their system in a broken way
I'm getting a bit fed up with failed reports from arch users where they just
have a broken system. I don't think it's useful to upload to the LVFS or notify
the vendor about failures like this.
2019-04-18 22:06:01 +08:00
Mario Limonciello
38027e696b Allow setting the daemon verbose domains at runtime 2019-04-17 12:12:13 -04:00
Mario Limonciello
bfcf75b7a6 Allow fwupdmgr to modify the daemon config
This allows several things, for instance:

 * Adding or removing blacklisted plugins or devices
 * Changing the idle timeout where allowed

...without a user needing to manually modify a configuration file.
2019-04-17 12:12:13 -04:00
Richard Hughes
2c40b3734f Use the device version format when converting the release version
This is arguably the more correct fix, regardless of the UEFI quirk use as each
release was reading and converting the exact same property from the component.

Fixes https://github.com/hughsie/fwupd/issues/1156
2019-04-17 12:11:45 -04:00
Richard Hughes
21ab7f588c Set the VersionFormat using the metadata or the UEFI quirk
This allows existing Dell firmware to not ship a LVFS::VersionFormat key and
instead use the existing SmbiosManufacturer quirk.
2019-04-17 12:11:45 -04:00
Richard Hughes
75449d9db1 trivial: Return the superclassed FuDevice from fu_engine_get_details()
This allows us to print the daemon-specific properties like VersionFormat when
debugging. The caller can continue to operate on the subclassed FwupdDevice
without changes.
2019-04-17 12:11:45 -04:00
Richard Hughes
cce6a1cb5a Do not report transient failures
We don't need to report failures to do with AC or battery level to the LVFS.
2019-04-17 08:20:44 +08:00
Mario Limonciello
6c0e9ce6b4 fu-engine: When removing activation flag match the correct version 2019-04-09 04:24:15 -04:00
Richard Hughes
0b3e9fdb96 trivial: Allow detecting unsupported version formats in _from_string() 2019-04-09 04:16:32 -04:00
Richard Hughes
3d280caf4a Match the old or new version number when setting NEEDS_REBOOT
Some devices update then need a reboot, and other reboot to update.
2019-04-09 04:16:32 -04:00