Commit Graph

411 Commits

Author SHA1 Message Date
Richard Hughes
f1c79a8eae trivial: Fix a warning generated by new versions of meson
This fixes:

    DEPRECATION: Library fwupd was passed to the "libraries" keyword argument of
    a previous call to generate() method instead of first positional argument.
    Adding fwupd to "Requires" field, but this is a deprecated behaviour that
    will change in a future version of Meson.
2021-01-05 17:47:23 +00:00
Richard Hughes
104459bd10 Check the AMI test key if not installed for HSI-1
Fixes https://github.com/fwupd/fwupd/issues/2695
2021-01-05 17:09:02 +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
3252573ac7 synaptics-prometheus: Fix flashing a fingerprint reader that is in use
The fprint daemon only keeps the device open for 5 seconds and then releases it,
which seems like a small window to hit.

But! We're asking the user to authenticate with the same device we're about to
upgrade so a different part of the stack woke up the hardware just before we're
about to deploy an update onto it.

Just retry a few times to make sure the device is idle. Use a flag to prevent
accidentally causing regressions in other plugins.

Fixes https://github.com/fwupd/fwupd/issues/2650
2021-01-04 21:52:10 +00:00
Richard Hughes
f9fe19f7f6 Make libcurl optional for fuzzing
For fuzzing we want to exclude libcurl support as it depends on other very heavy
libraries like OpenSSL or libtasn which make the fuzzing binary much larger if
linked statically.
2021-01-04 16:22:36 +00:00
Richard Hughes
2e5c1d15bc Do not hardcode building shared libraries
Respect the -Ddefault_library meson define.
2021-01-04 15:26:28 +00:00
Richard Hughes
6a489a9eaf trivial: Add missing calls to g_return_val_if_fail() 2021-01-04 15:24:35 +00:00
Richard Hughes
7d5a4f391b libfwupd: Use G_GNUC_WARN_UNUSED_RESULT for methods that should be checked 2021-01-04 15:24:35 +00:00
Richard Hughes
9619514508 trivial: One more <string.h> missing include 2020-12-15 10:02:59 +00:00
Richard Hughes
93867eda8e Allow linking with the CXX linker
This is required by oss-fuzz, for non-obvious reasons!
2020-12-14 20:34:20 +00:00
Richard Hughes
c0d4c09a02 Lower libcurl requirement further still
This allows us to build on Ubuntu 16.04!
2020-12-14 16:50:30 +00:00
Richard Hughes
a14de30153 trivial: Require <string.h> for strlen() and memcpy() 2020-12-14 16:49:03 +00:00
Richard Hughes
68f565c441 Don't assume we have memfd_create() 2020-12-14 13:09:47 +00:00
Richard Hughes
39e391e046 Fix compile warnings when using -Db_sanitize=undefined 2020-12-14 08:33:41 +00:00
Richard Hughes
976b6afe63 trivial: Allow turning off the FMAP binary search when fuzzing
This speeds up the fuzzing task from 22ms to 33us.
2020-12-09 18:08:08 +00:00
Richard Hughes
7115d6c6a6 Do not leak global cargs out of libfwupd
This gives us warnings if a specific binary redefines the domain.
2020-12-08 20:53:59 +00:00
Richard Hughes
698099f643 trivial: Remove several unused variables 2020-12-08 20:06:46 +00:00
Richard Hughes
00640f42f2 Lower the CURL version required to fix build in RHEL
Some vendors really really want 1.5.x in newer RHEL versions, but the version
of curl is too old. Add #ifdefs so that we can emulate (somewhat imperfectly)
the 'new' CURLU functonality.
2020-12-07 14:17:22 +00:00
Tim Gates
88dc597125 docs: fix simple typo, rumtime -> runtime
There is a small typo in libfwupd/fwupd-client.c.

Should read `runtime` rather than `rumtime`.
2020-12-07 11:13:22 +00:00
Richard Hughes
95a5fb2e2f Allow setting the GMainContext when used for sync methods
Use the 'default' main context by default so that we still get the signals
delivered via g_object_notify() but allow the library user to specify an
alternate GMainContext as required.

Using g_main_context_push_thread_default() works for PackageKit as signals are
returned using g_signal_emit() which is synchronous, and so doesn't use the
main context at all.

Use the same style of API which we did for libgusb all those years ago instead.
2020-12-04 07:58:05 +00:00
Richard Hughes
289a1eec83 trivial: Add a few things we're going to change when we break ABI 2020-11-29 10:18:06 +00:00
Richard Hughes
9ba348cd7a Force the remote kind to JCat server-side
We can't do this in the library as Ubuntu want to ship a new libfwupd with an
old daemon. The new daemon only understands jcat and does not know how to
determine the age of an .asc file.
2020-11-29 07:24:33 +00:00
Richard Hughes
ced512c71f Only parse the signature if the remote is JCat
This fixes a regression from 2f49da7f4e where we
tried to parse the GPG .asc file as a JcatFile even although the remote had
Keyring=gpg (which is the default for ODM accounts on the LVFS) which returned
the cryptic 'Invalid compressed data' message.

The workaround for 1.5.2 is to change the local remote.conf from 'Keyring=gpg'
to 'Keyring=jcat' and to save the file.
2020-11-29 07:24:33 +00:00
Richard Hughes
cf575bd783 trivial: Fix several nonprefixed bare errors 2020-11-25 14:13:25 +00:00
Mario Limonciello
2f49da7f4e libfwupd: Restore recognizing gpg and pkcs7 types still
The snap-store intends to ship an updated libfwupd library but
to use it with whatever version daemon is on the host system.

This means that the library needs to still work with older metadata
signing types.

This fixes the following error in that scenario:
```Failed to update metadata for lvfs: Keyring kind jcat not supported```
2020-11-21 07:37:36 -06:00
Richard Hughes
23f9cca6b4 trivial: Fix regression on uploading reports without a signature 2020-11-20 10:44:54 +00:00
Richard Hughes
173d389fa5 Register the SoupSession gtype when required
This allows old gnome-software clients to work with new fwupd versions.
2020-11-19 19:39:37 +00:00
Richard Hughes
3a73c342ba Switch from libsoup to libcurl
The former drags on glib-networking and then gsettings-desktop-schemas, which
add over 5Mb to the minimal IoT and CoreOS composes. Everything already uses
libcurl (even NetworkManager!) and so this is an easy way to reduce image size.
2020-11-19 19:39:37 +00:00
Richard Hughes
1a14d2be00 Fix sync method when called from threads without a context
Set the thread-default context for the current thread before performing the
async operation.

Hopefully fixes https://github.com/fwupd/fwupd/issues/2600
2020-11-19 16:12:52 +00:00
Richard Hughes
02e7fb527a trivial: Ensure the user called fwupd_client_set_user_agent() as asked 2020-11-18 08:17:28 +00:00
Richard Hughes
56fcdd2776 libfwupd: Add fwupd_client_download_file()
I'm porting gnome-software to use this new API and this would be a very useful
thing to provide. No async API as we want to avoid writing temp files in most
cases -- this is just for legacy apps.
2020-11-18 08:17:28 +00:00
Richard Hughes
eba28b6520 libfwupd: Add fwupd_client_get_user_agent()
If we set a property, we should probably have a way to read it back...
2020-11-17 21:10:10 +00:00
Richard Hughes
42577728bb Only download the remote metadata as required
Moving to the async libfwupd library design meant this optimization was lost.
2020-11-17 12:14:30 -06:00
Mario Limonciello
90e80e6752 trivial: allow building as a subproject 2020-11-13 06:17:47 -06:00
Richard Hughes
4d781ae14f Revert "If incorporating the version from a subclass, also set the verfmt too"
This reverts commit c0dee27b6d.
2020-11-07 07:57:50 +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
11832e10af trivial: Fix a warning when generating the GtkDoc pages 2020-11-06 13:18:25 +00:00
Richard Hughes
c0dee27b6d If incorporating the version from a subclass, also set the verfmt too
Otherwise we could be left with a device that sets the expected verfmt in the
plugin _init(), but would not be inherited from the subclass. It would have:

    Version:              0.2
    VersionFormat:        triplet

...which makes no sense.
2020-11-06 13:04:34 +00:00
Richard Hughes
e612078b8d Remove the duplicate parent-child data in FwupdDevice and FuDevice
The FuDevice derives from FwupdDevice, and yet both objects have a (potentially
different) parent and set of children. This is super confusing, and just not
required.

Removing the duplication also removes a sizable memory leak when hotplugging
composite devices as the parent was ref'd by the child and the child was ref'd
by the parent in different objects... Fun to debug...
2020-10-31 13:19:11 +00:00
Richard Hughes
8087b2c9e0 trivial: Set the 'downloading' state when starting the download
For small files we might not get progress callbacks and so we stay in IDLE
status forever.

Fixes https://github.com/fwupd/fwupd/issues/2522
2020-10-27 19:36:18 +00:00
Mario Limonciello
c3a8173a12 Show an error when a plugin is missing dependencies (Fixes: #1526)
```
$ sudo mv /usr/lib/x86_64-linux-gnu/libtss2-esys.so.0.0.0 /usr/lib/x86_64-linux-gnu/libtss2-esys.so.0.0.0.renamed
$ sudo fwupdtool get-devices --plugins=uefi
14:15:48:0735 FuEngine             cannot load: failed to open plugin /usr/local/lib/x86_64-linux-gnu/fwupd-plugins-3/libfu_plugin_uefi.so: libtss2-esys.so.0: cannot open shared object file: No such file or directory
Loading…                 [-                                      ]14:15:48:0753 FuEngine             failed to update history database: device ID b6c08fb9e5384d9d101853cc1ca20cf0ce2df2e2 was not found
Loading…                 [***************************************]
WARNING: Plugin depdendencies missing
No detected devices
```
2020-10-20 10:57:21 -05:00
Richard Hughes
7bcb8d4385 Export FwupdPlugin so we can convey enumerated system errors to the end user
For instance, we can tell the user that UEFI UpdateCapsule is disabled in the
system firmware, or that efivarfs is not mounted. This is much better than
creating "dummy" devices which are really just hacks around the problem because
no better API existed. THe dummy devices cause as many problems as they solve.

Plugins have to set FWUPD_PLUGIN_FLAG_USER_WARNING if a warning should be shown
to the user, and only one warning will be shown of each failure type.

It is expected that GUI clients like gnome-software and gnome-firmware would use
this API to notify the user the localized message for why firmware updates are
not being shown.

Fixes https://github.com/fwupd/fwupd/issues/2456
2020-10-13 15:56:49 +01:00
Richard Hughes
f4c206d319 libfwupd: Do not export the HSI AppStream IDs
The clients don't need to know this, and exporting them means we paint-ourselves
into a corner if we want to change the 'namespace' or how HSI actually works.
2020-10-08 16:36:56 +01:00
Richard Hughes
27b399ce27 libfwupd: Actually use the JCat file to select the metadata file
This recent regression was caused when porting libfwupd to the async model.

Fixes https://github.com/fwupd/fwupd/issues/2360
2020-10-07 15:38:08 +01:00
Richard Hughes
6450d0deb4 Add FwupdInstallFlags of _IGNORE_CHECKSUM, _IGNORE_VID_PID and _IGNORE_POWER
The FWUPD_INSTALL_FLAG_FORCE flag has really unclear semantics, and ignoring a
file CRC, checksum or model ID should only be done when using fwupdtool actually
debugging a plugin or firmware parser.

Use the existing --force flag when we want a "gentle nudge" like reuploading
previously processed reports.
2020-10-07 13:15:09 +01:00
Richard Hughes
5bbf013879 Add a --allow-branch-switch to fwupdmgr
This allows us to turn off the tests like version format differences and
checking for downgrades.
2020-10-07 13:15:09 +01:00
Mario Limonciello
2195237f12 trivial: don't show OS release paths checked 2020-10-03 06:58:13 -05:00
Richard Hughes
1a61258239 Allow devices to save the old firmware to disk for recovery
This would also help, for example, to go back to the nonfree firmware when the
alternate firmware did not work as well as hoped. It would also allow flashing
the firmware using an SPI programmer if everything went very wrong indeed.
2020-09-30 18:33:00 +01:00
Richard Hughes
460c4b75fe Add the concept of firmware 'branches'
This allows a device to identify with different streams, for instance a Lenovo
laptop could have a coreboot firmware or a AMI firmware. The GUIDs would be the
same, but switching firmware would only be done rarely and very carefully.

Another example would be switching the Broadcom BCM57xx nework adaptors from the
vendor nonfree firmware with a signed PXE image, to the free software reverse
engineered driver with no PXE support (and thus no signed DXE) at all.

It is expected firmware would have additional metadata something like this:

    ...
    <branch>sdcc</branch>
    <description>
      <p>
        This is an alternate firmware built by the community using only free
        software tools.
      </p>
    </description>
    <requires>
      <id compare="ge" version="1.5.0">org.freedesktop.fwupd</id>
      <client>switch-branch</client>
    </requires>
    ...

Additionally, alternate branch firmware will not be returned for clients not
setting the FWUPD_FEATURE_FLAG_SWITCH_BRANCH before the GetReleases request.
2020-09-30 18:33:00 +01:00
Richard Hughes
6f4f1caca4 trivial: Fix some typos spotted by codespell 2020-09-24 10:48:26 +01:00