Commit Graph

503 Commits

Author SHA1 Message Date
Richard Hughes
664226a350 spi: Move all the IFD parsing to the new 'spi' plugin
We do not want to export this unfinished API, and it's probably best just to
not compile it by default until it is actually useful.
2021-03-15 09:45:17 +00:00
Richard Hughes
3891171641 trivial: Fix compile if no backends are enabled
Fixes https://github.com/fwupd/fwupd/issues/3023
2021-03-12 14:19:57 +00:00
Richard Hughes
a76a0da7aa Add fu_device_set_battery_level()
We want to make it as easy as possible for devices to refuse to update on low
battery, as this will likely be one of the WWCB requirements.

Ideally devices will check the battery level inside the firmware, but by also
providing the battery level to fwupd we can give the user a warning *before*
the update has started and without switching the device into bootloader mode.
2021-03-05 12:27:10 +00:00
Richard Hughes
e19ebe7177 Add an Intel Flash Descriptor parser 2021-03-05 10:51:34 +00:00
Richard Hughes
21c44d1f8a Fix the HSI plugin 'Disabled' state
I broke this when adding test_ble.

Fixes https://github.com/fwupd/fwupd/discussions/2963
2021-03-03 14:29:45 +00:00
Richard Hughes
7d132b728c Simplify the quirk file format
The best way of not getting something wrong is to not require it in the first
place...

All plugins now use DeviceInstanceId-style quirk matches and we can just drop
the prefix in all files. We were treating HwId=, Guid= and DeviceInstanceId= in
exactly the same way -- they're just converted to GUIDs when building the silo!
2021-03-03 08:30:34 +00:00
Richard Hughes
42f43fe8a3 trivial: Actually disable plugins with _REQUIRE_HWID 2021-03-02 18:29:27 +00:00
Richard Hughes
d94286b9de Allow enabling plugins only matching a specific HwId
At the moment plugins are doing this a few different ways; either looping
through the HwIds manually (e.g. flashrom) or setting a custom flag that is
checked in fu_plugin_setup (e.g. uefi-recovery).

Define a standard 'Plugin' HwId quirk to simplify plugins.
2021-03-02 18:19:45 +00:00
Richard Hughes
05217338b3 uefi: Do not use fu_plugin_has_custom_flag() in _init()
This means we can defer loading the quirks until all the plugins have loaded.
2021-03-02 06:33:46 +00:00
Richard Hughes
b3f9841924 Support more than one protocol for a given device
Devices may want to support more than one protocol, and for some devices
(e.g. Unifying peripherals stuck in bootloader mode) you might not even be able
to query for the correct protocol anyway.
2021-03-01 16:14:36 +00:00
Richard Hughes
253e6e4f17 Add a backend ID to the device
This is typically a Linux sysfs path or USB platform ID and is used in a
different way to the physical ID. The physical ID is only set for some devices
after setup() and depends on the subsystem list, and this would not be defined
for devices that do not match a plugin.

This also fixes an regression where the FuDeviceList fails to match the new
FuUdevDevice device in fu_device_list_get_by_guids_removed() and instead
silently gets 'fixed up' only if FWUPD_DEVICE_FLAG_NO_GUID_MATCHING is not set.

This also allows us to move the various backends device caches to FuBackend as
we now have a suitable ID that is for just the backend to use.
2021-02-24 16:49:42 +00:00
Ricardo Cañuelo
536fb85e21 Add initial support for Bluez bluetooth devices
Bare skeleton for what will be the Bluez backend and the base bluetooth
device class.
2021-02-22 16:53:41 +01:00
Richard Hughes
f3c3adb7f0 trivial: Add some more verbose debugging to help with plugin development 2021-02-19 09:33:07 +00:00
Richard Hughes
404f052409 Do not fail to start the daemon for a single backend setup failure 2021-02-16 21:26:50 +00:00
Richard Hughes
117f857899 Split the Udev and USB backends out of FuEngine
We get to say "hello" to Bluetooth devices soon...
2021-02-10 12:04:05 +00:00
Richard Hughes
525f71f54b Merge the _udev_device() and _usb_device() vfuncs
There are now two 'backends' of device plug/unplug events, and there is about
to become three. Rather than just adding two more vfuncs for every backend type
define common ones that all providers can use.

Also fix up the existing in-tree plugins to use the new vfunc names and filter
on the correct GType.
2021-02-10 12:04:05 +00:00
Richard Hughes
9e9b73f303 Remove fu_plugin_get_usb_context()
It's unused, and only encourages plugins to do the wrong thing.
2021-02-10 12:04:05 +00:00
Richard Hughes
b2a1d9747e Clear the pending flag if restarting the system
If any update is scheduled for SuperIO, and something changes (such as entering
S3, disconnecting the charger) before the update is installed, then the update
will get stuck.

Fixes https://github.com/fwupd/fwupd/issues/2830
2021-02-03 16:59:12 +00:00
Richard Hughes
98972f4a34 libfwupdplugin: Promote DfuFirmware to FuDfuseFirmware
Port the DFU plugin to use the new objects to make it act the same as all the
other plugins.
2021-02-01 19:34:28 +00:00
Richard Hughes
c2f7ed335e trivial: Support <filename> as a child of <artifact> too 2021-01-28 20:11:03 +00:00
Richard Hughes
b856f0bc42 Allow configuring URI scheme preferences
This would allow, for instance, only allowing IPFS downloads or preferring
https over http downloads.
2021-01-28 15:34:36 +00:00
Richard Hughes
5213fa5a4d trivial: Do not fallback if reading from <artifact> 2021-01-28 15:24:30 +00:00
Richard Hughes
b8dfaccce7 libfwupd: Add fwupd_release_add_location()
The metadata might want to pass more than one location URI to the client, for
instance if the file is available from more than one HTTP mirror.

Use the noun of location to match the AppStream <artifact> naming; this is the
last place where LVFS AppStream diverges from the official specification and
it would be good to bring fwupd back into line -- although the LVFS will have
to write both elements for a very long time.

See https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html

Also: we're not changing the format of the `Uri` GVariant key to preserve both
forward and backwards compatibility of the library. We can remove it when we
next break API.
2021-01-26 14:26:06 +00:00
Richard Hughes
e52e1b49ad trivial: Add fu_common_strjoin_array() to join arrays of strings 2021-01-26 14:25:56 +00:00
Mario Limonciello
75835b4a0b Use FWUPD_COMPILATION define to indicate an in tree build
When this is done, include:
* Including the hash
* Including anything that is not ABI stable in plugins yet

Suggested-by: Simon McVittie <smcv@debian.org>
2021-01-22 14:01:25 -06:00
Richard Hughes
60441f96a5 Set the device needs-reboot flag if the system has not yet rebooted
If fwupd has idle-quit or been upgraded but the user has not rebooted then
repair the update state as required.
2021-01-14 21:13:38 +00:00
Richard Hughes
1a3d3b338e Make GUsb optional for fuzzing 2021-01-14 14:23:12 +00:00
Richard Hughes
5c9b1fcc81 Only include the start year in the copyright header
The end year is legally and functionally redundant, and more importantly causes
cherry-pick conflicts when trying to maintain old branches. Use git for history.
2021-01-07 14:48:16 +00:00
Richard Hughes
cf100293b5 Do not export useless device attributes to the client
That giant uint64_t isn't looking so big now, and we'll want to add even more
to it in the future. Split out some private flags that are never useful to the
client, although the #defines will have to remain until we break API again.
2021-01-06 14:36:23 +00:00
Mario Limonciello
3165e94f7d trivial: fu-engine: correct a logic error in the daemon for thunderbolt
WD19TB uses skip-restart in some cases, but not all.
The matrix of cases is enumerated in 834b28009d

Unfortunately in the most common case now - new kernel and new daemon
`skip-restart` *isn't* used.  The device should be left in a `needs-activation`
state though.

Use this to skip the trigger of failed upload report.

Fixes: #2731
2021-01-06 09:11:00 +00:00
Richard Hughes
338cab9e73 libfwupdplugin: Subclass FuFirmware in FuSmbios
This allows us to get fuzzing support for free.
2021-01-05 15:59:30 +00:00
Richard Hughes
eddaed0c11 Allow specifying more than one VendorID for a device
Asking the user for the UID mapping isn't working very well, as it requires lots
of manual handholding. It also doesn't work very well when the device vendor
does not actually have a PCI ID or if the vendor has split into two entities.

Just use the OUI address as an additional VendorID and match any of the device
IDs against any of the metadata-supplied values.
2021-01-04 22:30:20 +00:00
Richard Hughes
db8533f743 trivial: Don't accidentally depend on GLib 2.54.3
None of these branches are important enough to provide fallbacks for.
2020-12-14 15:33:00 +00:00
Richard Hughes
c7d870aa97 Allow using fwupdtool as non-root for firmware commands
Just avoid loading SMBIOS and re-generating remotes when all we want to use is
the firmware loader. It also speeds up the self tests somewhat too.
2020-12-10 20:43:54 +00:00
Philip Withnall
aa48b6b0e3 libfwupdplugin: Support new libxmlb query binding API
See https://github.com/hughsie/libxmlb/pull/67. This doesn’t bump the
hard version dependency.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-12-08 14:39:40 +00:00
Richard Hughes
0ec634e7db trivial: Codespell fixes 2020-12-07 20:55:18 +00:00
Mario Limonciello
9e96d417a7 trivial: fu-engine: If a device is using delayed activation don't flag failure
Should hopefully fix this failure:
```
Plugin thunderbolt
UpdateError device version not updated on success, 43.00 != 40.00
VersionNew 43.00
VersionOld 40.00
```
2020-12-01 08:20:50 -06:00
Richard Hughes
9d3605adad trivial: Allow dumping devices before matching possible plugins 2020-12-01 14:15:33 +00:00
Richard Hughes
8a9f1674a3 trivial: Show when there are no subsystem devices
If we asked for a subsystem, it's nice to know there are not actually any of the
supported devices.
2020-12-01 14:15:33 +00:00
Richard Hughes
8bcc5f3e80 Allow the client to send PKCS7 and GPG signatures
This restores compatibility when running with a new daemon and old remote files
and properly fixes all combinations of the regression casued by the commit
2f49da7f4e which appeared in the 1.5.2 release.
2020-11-30 15:16:39 +00:00
Richard Hughes
4cbe99c607 Restrict loading component types of firmware
This would allow us to add other component types in the future, for instance a
'generic' type that adds information to the composite device.

Any generic components would need to have a requirement of 1.5.2 to avoid
showing a runtime warning when trying to get the local file details.
2020-11-29 07:06:29 +00:00
Richard Hughes
d483fcedd5 trivial: Fix a logic thinko to unbreak switch-branch
We still want to return TRUE, rather than falling through as if the requirement
type was unknown.

Fixes https://github.com/fwupd/fwupd/issues/2578
2020-11-13 16:21:57 +00:00
Jan Tojnar
a8b3f9ed57 trivial: fu-engine: skip empty cmdline commands
g_strsplit returns an empty vector for an empty string,
which leads to assertion in g_strv_contains when /proc/cmdline
ends with a space.
2020-11-07 19:51:07 +00:00
Richard Hughes
3e445ece04 Allow components to set the icon from the metadata
In this case, we want to set the generic ESRT entry to have the icon 'battery'.
2020-11-06 16:57:21 +00:00
Richard Hughes
41a1650c2a Remove HSI update and attestation suffixes
The logic here is that the attestation is more than just the PCR0 value, and
multiple device firmware (such as EC, ME, etc.) needs to be included to validate
the system.

By the same logic, updates for the system firmware do not tell the whole story,
and confuse HSI as a specification. Remove them.
2020-11-05 15:12:12 +00:00
Richard Hughes
bf43978dfa Ignore an invalid vendor-id when adding releases for display
The idea for a missing vendor-id would be that the LVFS sets the value
`NEVER_GOING_TO_MATCH` which is shown (along with the correct value) when the
user tries to **install** the firmware.
In 1.5.0 we correctly switched to filtering the devices by GUID and *then*
checking requirements before showing to the user.

In the missing vendor-id case the the poor ODM does not know why the device is
not showing up until they run the daemon in --verbose mode.

Relax the vendor-id checks when adding releases to devices, but of course leave
them in place for installing firmware. The ignore-vid-pid flag is not added
from `Install(a{sv})` and so this stays the same as before.
2020-11-04 16:14:00 +00:00
Mario Limonciello
13d077353b Revert "fu-engine: Set a device when checking requirements for fu_engine_get_result_from_component"
This reverts commit e4d52866d1.
2020-10-24 07:07:26 +01:00
Mario Limonciello
381c27ca44 trivial: Split check for signed metadata when no polkit
Checking this requirement at daemon startup meant that trust was
evaluated before releases could actually be checked.

It's only important to check at install time.
2020-10-24 07:07:26 +01:00
Mario Limonciello
e4d52866d1 fu-engine: Set a device when checking requirements for fu_engine_get_result_from_component
The trust flags are only checked if check_requirements is called, which
only happens when a device has been set.
2020-10-23 06:59:08 +01:00
Mario Limonciello
7db8e88d98 When PK is disabled only allow trusted payloads
Loosen the requirement of the user ID to match root for the following
actions:
* Install release
* Activate firmware

For install release action, reject CAB files not signed by LVFS
2020-10-20 15:24:08 -05:00