Commit Graph

224 Commits

Author SHA1 Message Date
Richard Hughes
f425d29a28 Show a console warning if loading an out-of-tree plugin
Fixes https://github.com/hughsie/fwupd/issues/950
2019-01-19 07:26:20 +00:00
Richard Hughes
f803964e37 Add _NEEDS_SHUTDOWN flag for devices
Some devices require the system to be powered down and back up, rather than
just being "warm" rebooted.
2019-01-17 16:35:34 +00:00
Richard Hughes
a958e1c32f trivial: Fix a potential type-check warning when setting SUPPORTED
We can't use the superclassed FuDevice as this was created as a FwupdDevice.
2019-01-17 16:35:34 +00:00
Mario Limonciello
46aaee8cec fu-tool: Add support for an 'update' command to fwupdtool
This will perform updates with all currently present metadata.

It is "intended" for usage with local metadata repositories referring
to local files.

fwupdtool however does also support fetching a file from the web
and if the metadata refers to the file on the web it should also work
for that.
2019-01-11 12:59:00 +00:00
Mario Limonciello
baa5af4504 trivial: fu-engine: Clarify the message when no releases are available 2019-01-11 12:59:00 +00:00
Richard Hughes
319dbcba5c trivial: Don't show 'Update Duration: 49710 days'
Use the correct 'value not found' constant for xb_node_get_attr_as_uint().
2018-12-18 17:59:09 +00:00
Richard Hughes
45bbfc9cae Check the device checksum as well as the content checksum during verify
Some firmware has a different on-device checksum to the hash of the firmware
file itself. This may be because:

 * The content is not a binary file, e.g. Intel HEX or SREC
 * Only part of the firmware is flashed, e.g. ignoring the bootloader section
 * The device checksum is calculated using another method entirely, e.g. PCR0

It's also made complicated as there may be more than one 'correct' device
checksum in some cases, but nothing that a union query can't solve.
2018-12-14 19:23:04 +00:00
Richard Hughes
4e886a4dfa Include the device checksum and update protocol in the historydb 2018-12-14 19:23:04 +00:00
Richard Hughes
adeb2b1b4d Add new API to get the release protocol from the metadata 2018-12-14 18:15:01 +00:00
Richard Hughes
d583bafb6f Only run attach and detach if the device is in the wrong mode 2018-12-06 08:22:00 +00:00
Richard Hughes
a07a80ff28 Fix a regression when doing GetReleases on unsupported hardware
With an indexed string we can return INVALID_ARGUMENT before the query actually
runs if nothing matches.
2018-12-03 15:02:48 +00:00
Richard Hughes
1af48b13bd Correctly parse format the version numbers correctly using old metadata
The LVFS has always sent components with the old-style '<metadata>' section
rather than the new-style '<custom>' section, and when using appstream-glib
we just accepted either element name. Although the LVFS has just been fixed to
use the new name, old metadata might be present on the system already.

When all clients have downloaded new metadata we can revert this, perhaps in a
couple of weeks time. Until then, the belt-and-braces approach is probably a
good idea.

Fixes https://github.com/hughsie/fwupd/issues/874
2018-12-03 12:14:28 +00:00
Richard Hughes
ec6190c4bf trivial: Fix regression when switching to indexed strings
When we construct a local silo we need to build the index again.

This fixes 'fwupdmgr get-details foo.cab'
2018-11-25 12:19:39 +00:00
Richard Hughes
328b00eec3 Remove DaemonVersionFormat=quad
This metadata key is now unnecessary, as firmwares are expected to set the
version format in the metadata.

If the metadata is missing, the LVFS allows a per-vendor default for non-semver
release versions which is now unconditionally set in metadata.
2018-11-21 19:06:51 +00:00
Richard Hughes
75b965d01d Shut down the daemon after 2h of inactivity
Plugins are allowed to 'opt-out' of this behaviour using _RULE_INHIBITS_IDLE.
This should be used where waking up the hardware to coldplug is expensive,
either from a power consumption point of view, or if other artifacts are going
to be seem -- for instance if the screen flickers when probing display devices.

This functionality is also inhibited when the actual upgrade is happening,
for obvious reasons.

Admins can turn off this auto-sleep behaviour by editing the daemon.conf file.

Fixes https://github.com/hughsie/fwupd/issues/417
2018-11-21 18:54:44 +00:00
Richard Hughes
634da03730 Create a silo index to speed up GUID queries
This speeds up matching for GUIDs by about 90%, taking the query from 3.17ms to
about 0.33ms on my Thinkpad. This is more important for slow ARM hardware,
where strcmp() is more expensive than on x64.
2018-11-21 18:51:07 +00:00
Richard Hughes
d76ed3de28 Fix flashing the 8bitdo SF30
We have to check for the SUPPORTED flag _after_ the FuDeviceList has added the
missing GUIDs from the device when it was in runtime mode.
2018-11-15 15:43:43 +00:00
Richard Hughes
ab1bc89ea8 trivial: Do a single query when getting a component by a set of GUIDs 2018-11-15 15:43:43 +00:00
Richard Hughes
aabdc371c1 Query the XbSilo when calling fu_plugin_check_supported()
This means we don't have to have all the thousands of GUIDs as tiny allocated
strings being passed around to all plugins in a GPtrArray.

This also reduces our heap usage by about 6%.
2018-11-14 15:32:55 +00:00
Richard Hughes
6e0c8f8742 Add per-release install duration values
These are set from the AppStream metadata and are specific to the firmware
release.

If not provided, the install duration falls back to the per-device duration
values which can be set in the quirk files.
2018-11-12 14:18:28 +00:00
Richard Hughes
d56ad5b440 trivial: Fix a possible critical warning when parsing invalid metadata 2018-11-12 14:18:28 +00:00
Richard Hughes
0393f6fa81 Be more explicit setting the update state
If the FuDevice is changed during a replug then the `UPDATE_STATE_SUCCESS` will
not be stored on the current FuDevice, which means we store an update-state of
`unknown` to the history database.

Which means we get no success or failure reports, which is bad.
2018-11-09 15:13:56 +00:00
Richard Hughes
3b743402f5 Include the os-release information in the release metadata
This means we are storing the distro that was used to perform the update,
rather than the distro that was used to do the upload.

Fixes https://github.com/hughsie/fwupd/issues/838
2018-11-09 15:13:56 +00:00
Richard Hughes
33171fd24d trivial: Store the AppStream component metadata correctly
We want the XML to look like:

  <custom>
    <value key="fwupd::RemoteId">lvfs</value>
  </custom>

not:

  <custom>
    <fwupd::RemoteId>lvfs</fwupd::RemoteId>
  </custom>

Also, fix the XPath query string to actually match the container checksum, and
actually save the custom node to the builder source.

This fixes a regression in 1.2.0 where no reports could be uploaded.
2018-11-09 15:13:56 +00:00
Richard Hughes
aaa60c60d9 trivial: Fix a typo in the verification store export 2018-11-07 11:05:50 +00:00
Richard Hughes
b095df6d4d trivial: Fix some NULL/FALSE confusion 2018-11-05 16:36:06 +00:00
Mario Limonciello
387f039bea trivial: fu-engine: Increase the priority on a device if it has children
This will cause devices with children to be displayed (and potentially
processed) before children devices.
2018-10-24 13:39:37 -05:00
Mario Limonciello
343095ddb5 trivial: fu-device-list: Return devices by priority 2018-10-24 13:39:37 -05:00
Richard Hughes
481aa2a923 Port from libappstream-glib to libxmlb
The libxmlb library is much faster to query, and does not require the daemon
to parse the XML metadata at startup. It's a zero-copy mmap design that is more
modern and less clunky.

RSS has reduced from 3Mb (peak 3.61Mb) to 1Mb (peak 1.07Mb) and the startup
time has gone from 280ms to 250ms.
2018-10-17 14:41:13 +01:00
Richard Hughes
416ade7f30 trivial: Hardcode the AppStream-glib version
This is the version we've imported from, which allows cabinet files requiring a
specific version of this library to continue working.
2018-10-11 07:54:01 +01:00
Richard Hughes
05cbb7245c Don't use AppStream-glib for version helpers
Refactor the imported version format code now we now longer need to stick to
the API mistakes of libappstream-glib.
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
Mario Limonciello
78599edcc9 trivial: correct a memory leak of the FuDevice when replugging 2018-10-10 11:24:27 -05:00
Richard Hughes
12c849966d Allow firmware files to depend on versions from other devices
At the moment firmware can declare that it has certain requirements, for
instance the existing firmware version, the bootloader version, or the
vendor ID of the device.

In some situations we actually want to check the firmware version of a
*different* device. Good examples here would be only allowing an EC upgrade if
a specific BIOS update has already been done, or only allowing a wireless
reciever to be updated if the attached wireless devices have been updated first.

To use this, you can do something like:

    <requires>
      <id compare="ge" version="1.1.3">org.freedesktop.fwupd</id>
      <firmware compare="ge" version="0.9.0">guid-of-other-device</firmware>
    </requires>
2018-10-02 06:53:52 -05:00
Mario Limonciello
769d768be9 trivial: fu-engine: downgrade couldn't find new device message to debug
I've found that this message comes up sometimes due to reprobing order
and it shouldn't be considered important enough to generate a warning.
2018-10-02 11:52:28 +01:00
Mario Limonciello
9cecbe1d1b fu-engine: Optionally wait for replug before updating a device
Plugins may have marked a device as needing to replug duing a
composite device preparation due to the order devices were plugged
in.
2018-09-27 09:18:31 -05:00
Richard Hughes
e671c05771 trivial: Do not use AsProfile
The profiling data is of limited use, and better data can be obtained using
kcachegrind and massif. Additionally, the profile samples were the cause of the
small RSS growth over time, when in reality the data would only be shown when
the verbose switch is used at daemon startup.
2018-09-18 06:23:25 -05:00
Mario Limonciello
fc139357e1 fu-engine: Don't show devices pending a reboot in GetUpgrades
Fixes part of http://gitlab.gnome.org/GNOME/gnome-software/issues/341
2018-09-13 10:37:29 -05: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
5a9a6bd479 trivial: Return reference counted devices from FuDeviceList 2018-09-12 16:10:38 +01:00
Mario Limonciello
e6d2cf4dda trivial: Skip debugging messages for skipped releases
These are less interesting than which releases actually get added.
2018-09-11 18:59:05 +01:00
Richard Hughes
a1e82d3448 trivial: Add the components to the daemon store in one operation
This removes hundreds of lines of debugging spew.
2018-09-11 18:59:05 +01:00
Richard Hughes
17558acb35 trivial: Only show the number of loaded components at startup 2018-09-11 18:59:05 +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
7772dcfc91 trivial: Ensure the daemon sends IDLE when firmware is updated 2018-09-10 16:12:12 +01:00
Richard Hughes
ebae396d0a udev: Do not add devices after a small delay
Now devices can have multiple GUIDs and do not share platform IDs there is
really no point waiting to add the device.

This allows us to remove a whole lot of code for this now-unused functionality.
2018-09-09 16:24:30 +01:00
Mario Limonciello
b6fa47381e trivial: Refresh the list of devices sent to composite_cleanup()
If one of the devices went into replug during update the FuDevice instance will
have changed.
2018-09-07 15:16:14 +01:00
Richard Hughes
405baebbf2 trivial: Don't allow plugins to call fu_udev_device_emit_changed() 2018-09-06 16:22:46 +01: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
037ce37fe6 trivial: Add some error prefixes to help debug a replug issue 2018-09-06 09:24:23 +01:00