Commit Graph

29 Commits

Author SHA1 Message Date
Richard Hughes
2bbb7d2b40 trivial: Merge some GtkDoc introspection fixes 2020-11-30 09:18:45 +00:00
Richard Hughes
203ed841da trivial: Codespell fixes 2020-11-02 14:26:26 +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
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
Mario Limonciello
67a8b89453 trivial: clean up some debugging statements 2020-09-28 15:58:53 -05:00
Mario Limonciello
6d23514fb1 Revert "fu-plugin: add a new udev_device_changed function that calls rescan"
This reverts commit 096e3cfbb6.
2020-09-11 13:15:51 -05:00
Richard Hughes
aae22e4df5 trivial: Always clear the mutex before clearing the thing it protects 2020-06-22 21:55:50 +01:00
Richard Hughes
11c5941f23 libfwupdplugin: Make FuPlugin::rules lazy loaded 2020-06-22 21:55:50 +01:00
Richard Hughes
ea327fc13f libfwupdplugin: Make FuPlugin::udev_subsystems lazy loaded
In most cases except tests the engine uses fu_plugin_set_udev_subsystems()...
2020-06-22 21:55:50 +01:00
Richard Hughes
371f6b2bfa libfwupdplugin: Make FuPlugin::devices lazy loaded
Most plugins don't actually use the per-plugin cache...
2020-06-22 21:55:50 +01:00
Richard Hughes
1d900f7d60 libfwupdplugin: Make FuPlugin::report_metadata lazy loaded 2020-06-22 21:55:50 +01:00
Richard Hughes
862ec5c65b Skip module unloading only if we are actually running under valgrind
See also: https://github.com/fwupd/fwupd/issues/2119
Reported-by: Anton Farygin <rider@altlinux.org>

Based on a patch by Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
2020-05-28 06:56:45 -05:00
Richard Hughes
3ecd22c764 trivial: Fix fu_plugin_runner_add_security_attrs() gtk-doc header 2020-05-19 20:13:47 +01:00
Richard Hughes
f58ac7316c hsi: Abstract out the list of FwupdSecurityAttr objects for plugins
This exports FuSecurityAttrs into libfwupdplugin so that we can pass the plugins
this object rather than a 'bare' GPtrArray. This greatly simplifies the object
ownership, and also allows us to check the object type before adding.

In the future we could also check for duplicate appstream IDs or missing
properties at insertion time.

This change also changes the fu_plugin_add_security_attrs() to not return an
error. This forces the plugin to handle the error, storing the failure in the
attribute itself.

Only the plugin know if a missing file it needs to read indicates a runtime
problem or a simple failure to obtain a specific HSI level.
2020-05-12 16:47:24 +01:00
Richard Hughes
399859e48b trivial: Allow plugins to signal that the security status has changed 2020-05-11 22:11:49 +01:00
Richard Hughes
196c6c69db Add support for the Host Security ID
The HSI specification assigns a simple text ID to the current state of firmware
security. As new vulnerabilities are found, and as protection measures are
updated, new requirements will be added to the required firmware behaviours for
each HSI value.

The HSI specification is currently incomplete and in active development, and
so the --force flag is required in all command line tools. The current ID value
will probably change on a given platform so please do not start using the result
for any kind of compliance requirements.
2020-05-11 22:11:49 +01:00
Richard Hughes
6a07870fa2 Add a vfunc that gets run after the device has been added
This allows per-plugin actions after the device has been open()ed and started.
2020-05-10 20:34:56 +01:00
Mario Limonciello
096e3cfbb6 fu-plugin: add a new udev_device_changed function that calls rescan 2020-04-29 13:15:45 -05:00
Richard Hughes
a8c6c02459 Do not conditionalize attach() and detach() on IS_BOOTLOADER
This is nice in theory, until you need to look at the bootloader status of the
parent, or of a different device entirely. Handle this in plugins for the few
cases we care about and stop setting or clearing IS_BOOTLOADER manually just to
get the vfuncs to be run.

Note: I do not think we want to use cleanup() for attaching devices not in
bootloader states -- as cleanup is only run at the end of the composite update.
2020-04-09 09:55:30 +01:00
Mario Limonciello
96117d19df trivial: 1.3.9->1.4.0
We decided to branch at 1.3.8 and backport fix only things for 1_3_X.
So bump all the new stuff to 1.4.0 (which will be next release)
2020-02-28 10:17:56 -06:00
Richard Hughes
5337a43802 trivial: Fix the comparison function in fu_plugin_get_config_value_boolean() 2020-02-21 12:04:32 +00:00
Richard Hughes
334ba7994c trivial: Add helper fu_plugin_get_config_value_boolean() 2020-02-20 14:55:10 +00:00
Richard Hughes
0f66a0236e Add a plugin vfunc to run after subclassed FuDevice creation
Sometimes the plugin will want to influence the subclassed device, for instance
by reading a per-plugin config file. At the moment there's no way to do this,
as even _device_registered() is explicitly designed for devices *not* created
by the plugin itself.

Even if _device_registered() was changed to include the plugin creating the
object it would still happen well after the device has done _probe() and/or
_setup() and would probably be too late to do anything useful.
2020-02-19 19:29:14 +00:00
Richard Hughes
21eaeeff8d trivial: Fix up some typos found using codespell 2020-01-14 12:25:41 +00:00
Richard Hughes
dad3597e76 Allow other plugins to contribute report metadata 2019-12-06 15:05:16 +00:00
Richard Hughes
00f66f659d trivial: Do not include non-introspectable functions in the GIR
If we do need these for managed languages, we can of course create boxed types
when requried.
2019-11-27 12:45:35 +00:00
Richard Hughes
a0d81c726f trivial: Fix up a few introspection problems in FwupdPlugin 2019-11-27 12:45:35 +00:00
Mario Limonciello
6b0e66354b Convert libfwupdprivate to a shared library libfwupdplugin 2019-11-27 11:32:43 +00:00