Commit Graph

1104 Commits

Author SHA1 Message Date
Richard Hughes
b97f07e7be Provide a way for plugins to decompress a custom archive to ram
This allows plugins to load an archive supplied as the 'deliverable' of the
cabinet archive. This means plugins can bundle up a set of images in a cross
platform way, for instance adding boot.img+os.img+manifest.xml into a zip file,
rather than having to (ab)use the DfuSe file format or deal with libarchive
directly.
2018-11-28 14:18:03 +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
af2d1c285e trivial: Do not show all the HWIDs at daemon startup
The same information can be seen in `/usr/libexec/fwupd/fwupdtool hwids` and
for most users verbose mode is turned off -- so we're doing all those expensive
allocations for nothing.
2018-11-14 15:32:55 +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
e9dfeb49c1 trivial: Remove unused functionality 2018-11-14 15:32:55 +00:00
Richard Hughes
3ccce7151e trivial: Mark GParamSpec values as static to reduce RSS 2018-11-14 15:32:55 +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
69fca1d754 Fix a use-after-free when using valgrind and --immediate-exit 2018-11-13 17:15:38 +00:00
Mario Limonciello
c7fe0a7453 trivial: Add quirk documentation
Fixes https://github.com/hughsie/lvfs-website/issues/192
2018-11-13 09:53:19 +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
26db91ba13 trivial: Create an empty tree before tests start
This ensures we only load the files we actually write in the test.
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
1985b706b9 Fix showing the custom remote agreements
This fixes a regression in 1.2.0 -- the XML files are metainfo.xml files and
thus don't have the surrounding <components> parent tag.

We also want to return XML without the <description> wrapper node, so switch to
including siblings instead.
2018-11-09 15:13:56 +00:00
Richard Hughes
fdcec2c6e8 trivial: Only include a single language in the metainfo silo
Return the warnings in the C locale like we did with appstream-glib.
2018-11-09 15:13:56 +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
42111a3880 trivial: Relax the timing requirements on the FuDevice poll test
If the poll source is scheduled just at the right time, we might only get 8x
'10ms ticks' in a 100ms window. This fixes an occasional build failure on
slower hardware and in CI.
2018-11-08 20:45:35 +00:00
Richard Hughes
be95da483c trivial: Fix some NULL/FALSE confusion 2018-11-07 11:13:23 +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
67b82af7f8 trivial: fu-tool: Try to stop systemd even if not compiled with systemd
This allows the flatpak (which is compiled without systemd) to be able
to stop the running system daemon.
2018-11-02 06:47:47 -05:00
Mario Limonciello
137de52927 trivial: fu-tool: use g_variant_unref instead of g_object_clear
For dbus call to stop unit.
2018-11-02 06:47:47 -05: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
ab8849aee1 Use HTTPS_PROXY if set
Apparently, most application support both the lower and upper case versions...

Fixes https://github.com/hughsie/fwupd/issues/815
2018-10-24 13:16:27 +01:00
Richard Hughes
e4ad25044a Sort the firmware sack by component priority
This allows composite firmware to be ordered in an explicit way.
2018-10-23 09:20:02 +01:00
Mario Limonciello
62f8486ffe fwupdmgr/fwupdtool: Move monitor command to fwupdtool
This command is used for monitoring events from the daemon and normally
used only by power users or developers.
2018-10-18 19:36:59 +01:00
Mario Limonciello
f6d01b16de fwupdmgr/fwupdtool: Move firmware builder from fwupdmgr to fwupdtool
This command is really a power user command and should live in
fwupdtool with similar debugging and development features.
2018-10-18 19:36:59 +01:00
Richard Hughes
cdcd6a2423 trivial: Add VersionFormat to the fu_device_to_string() output 2018-10-18 19:31:04 +01:00
Richard Hughes
89ab873f72 trivial: Add yet another version encoding
This variant is a quad-style, but with the Microsoft style 4 digit BuildVer.
2018-10-18 19:31:04 +01:00
Richard Hughes
7fb61fdd1c Support the Intel ME version format
This slightly weird encoding is going to be used by Lenovo for firmware updates.
It will also be used to quirk the ME UEFI device added from the ESRT.
2018-10-17 15:25:52 +01: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
Mario Limonciello
6754f5aa70 fu-main: Catch SIGTERM while update is in progress
This prevents systemd from stopping while a firmware update is in
progress.
2018-10-16 13:06:23 -05:00
Mario Limonciello
e61c94dd25 fu-tool: Stop any running daemon over dbus before loading engine
This helps to prevent conflicts of the daemon trying to claim devices
at the same time as the tool.
2018-10-16 13:06:23 -05:00
Richard Hughes
3c8ada3f80 Don't segfault if a plugin returns FALSE from UpdateFunc with no error set
This is clearly a plugin bug that needs fixing, but exploding in a ball of
flames is not what anybody wants to see.
2018-10-12 10:34:12 +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
2b9ba9f756 trivial: Don't care so much about the AppStream-glib version 2018-10-11 07:54:01 +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
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
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
78599edcc9 trivial: correct a memory leak of the FuDevice when replugging 2018-10-10 11:24:27 -05:00
Mario Limonciello
2dd731b2f0 Update all sub-devices for a composite update
This allows a frontend to call update on an individual device ID which will
cause a CAB file to be downloaded, but then also re-use the same CAB file to
try to process devices with a relationship as part of a transaction.
2018-10-10 11:24:27 -05:00
Mario Limonciello
91353d48bd Stop showing the current release during updates in fwupdmgr
With handling composite CAB files this information isn't relayed to the
frontend on which release is being handled, but was rather guessed.

Avoid showing invalid information in this instance.
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
Richard Hughes
58bf3674e9 trivial: Show a critical warning rather than crashing
Found when constructing devices manually in the self tests, it's not possible
to hit this during normal runtime.
2018-10-02 11:03:12 +01:00
Mario Limonciello
70ae1d59ed fu-debug: Redirect all debugging output to stderr instead of stdout
This makes it easier for tools to still remain functional but capture
relevant debugging logs by calling `fwupdtool` with `--verbose 2>log`
2018-09-29 07:55:25 +01:00
Mario Limonciello
559c52ff71 trivial: Update FU_DEVICE_REMOVE_DELAY_USER_REPLUG from 20s to 40s (Fixes: #758)
Sometimes it's difficult to get 8bitdo controllers to turn off, so
give users more time to do it.
2018-09-27 09:22:24 -05: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
Mario Limonciello
8a45acb806 fu-device-list: Use delayed device removal when removing the tree
If a parent device being removed causes child devices to be removed,
take into account all of the delays for children.
2018-09-27 09:18:31 -05:00
Mario Limonciello
ccd5fd0088 trivial: device-list: Correct a minor logic error
If one of the child devices has gone away, this potentially will
cause the daemon to segfault while accessing it.
2018-09-26 07:56:12 -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
34fcc02052 trivial: Fix a tiny memory leak on startup
The property value is a floating reference, and so if we're not using it as a
parameter to g_variant_new() we need to unref it manually.
2018-09-19 18:17:38 +01: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
2d4b7a5826 trivial: fu-util/fu-tool: Move --version into a common shared function
This is mostly for usage with the flatpak so it's easy to tell what
version of the flatpak is installed.
2018-09-14 18:22:38 +01: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
fde4773294 fu-tool: Import debugging options from fu-debug like fu-main 2018-09-11 18:59:05 +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
36a2bd06ec trivial: Allow specifying --daemon-verbose to set the log handler 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
90f5070c0f trivial: Remove overzealous debugging 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
beb47a8a1f trivial: Remove an assert statement from the daemon
Asserts mean crashes, and crashes mean reported bugs. In this case the cause is
an older daemon loading plugins using newer features than it knew how to handle.
2018-09-11 18:42:38 +01:00
Richard Hughes
83cce1bdfa trivial: Fix a NULL/FALSE confusion 2018-09-10 16:42:30 +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
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
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
Mario Limonciello
e1c5cd8637 trivial: Look at both logical and physical IDs for replug matching
This resolves erroneously matching a logical child to it's parent if the child
is in replug.
2018-09-07 15:09:37 +01:00
Richard Hughes
bd747ded4f trivial: Use an elipsis when showing the remaining time 2018-09-07 14:29:18 +01:00
Richard Hughes
ed0512269a trivial: Support HID_PHYS in fu_udev_device_set_physical_id() 2018-09-07 14:28:52 +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
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
b5024e33a3 trivial: Do not overwrite device values set from quirk files 2018-09-06 12:50:51 +01:00
Richard Hughes
037ce37fe6 trivial: Add some error prefixes to help debug a replug issue 2018-09-06 09:24:23 +01:00
Richard Hughes
2a679cd3b5 trivial: Open the device in fwupdtool before attaching and detaching 2018-09-05 15:32:38 +01:00
Mario Limonciello
da0e90f263 fu-install-task: Allow using --force to ignore version_lowest (Closes #701) 2018-09-05 08:03:28 -05: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
14c823e967 trivial: fu-install-task: Correct error message ordering (#701) 2018-09-05 10:26:28 +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
Mario Limonciello
b4e4b0bdbd trivial: fu-usb-device: s/FU_IS_UDEV_DEVICE/FU_IS_USB_DEVICE/
Probably just a copy and paste error
2018-09-04 12:53:47 -05:00
Richard Hughes
8ddc864764 trivial: Do not set a vendor ID if the vendor is unknown 2018-09-04 18:02:09 +01:00
Richard Hughes
e1c519299b Fall back to the udev parent if the vendor is unknown
This lets us get the correct vendor for NVMe devices.
2018-09-04 18:02:09 +01:00
Richard Hughes
2c0635ae55 trivial: Fix up some more gtk-doc issues 2018-09-04 14:52:46 +01:00