Commit Graph

581 Commits

Author SHA1 Message Date
Richard Hughes
33a24c77b7 trivial: Add fu_plugin_set_config_value() for future usage 2021-09-07 17:25:37 +01:00
Richard Hughes
1a6414c41f trivial: Allow NULL GError for fu_device_locker_new()
It's correctly specified in the docs as 'nullable'.
2021-09-07 17:25:37 +01:00
Richard Hughes
fa64f8fd30 trivial: Fix a tiny memory leak for an invalid SREC file
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38196
2021-09-06 21:35:06 +01:00
Richard Hughes
9c6f676656 Actually check for parse errors when using fu_firmware_strparse_uintX_safe
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38141
2021-09-05 15:46:00 +01:00
Richard Hughes
d4fb04d6fc Allow overriding the quirks directory at runtime 2021-09-03 21:14:37 +01:00
Mario Limonciello
41c00ff404 trivial: libfwupdplugin: make the self tests not overwrite source folders 2021-09-03 15:10:38 -05:00
Mario Limonciello
65a7f87358 trivial: libfwupdplugin: remove unused PLUGINBUILDDIR 2021-09-03 15:10:38 -05:00
Richard Hughes
7020f49aa9 trivial: Fix a GObjectIntrospection warning by using the correct prefix 2021-08-28 06:50:50 -05:00
Richard Hughes
d8af914072 trivial: Remove some unused variables 2021-08-28 10:17:56 +01:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Mario Limonciello
d3983674f4 trivial: don't use same variable definition as config.h in code
If config.h is included by a file then which one is used may end up
be confusing.  Be explicit to use the values that are declared by
libraries.
2021-08-24 11:18:40 -05:00
Mario Limonciello
7ae233b7cf Forcefully set checksums found in cabinet files to lowercase
Archives uploaded to LVFS will have checksums written by hexdigest
and be set to lowercase, but hand generated archives this may not
be true.

For maximum compatibility with the most fwupd versions they should
be written in lowercase, but in case they aren't, convert to lowercase.

Reference https://github.com/fwupd/firmware-lenovo-thinkpad/issues/145
2021-08-18 14:18:28 -05:00
Richard Hughes
6f8ab5e70c Restart the daemon if any of the the plugin config files are modified
Fixes https://github.com/fwupd/fwupd/issues/3625
2021-08-11 14:27:47 +01:00
Richard Hughes
486f793df7 Recalculate the device inhibits when the flags property changes
Fixes https://github.com/fwupd/fwupd/issues/3622
2021-08-11 10:54:38 +01:00
Richard Hughes
bc759d0584 Fix cleanup and plugin to have the correct args order
All the other vfuncs have 'plugin, device, flags' but prepare and
cleanup vfuncs being 'plugin, flags, device' order has been triggering
my OCD for the last few years.

We've just broken the symbol names, so it's the right time to fix this.
2021-08-10 09:57:49 +01:00
Mario Limonciello
37e06fff1c trivial: bump 1.6.3->1.7.0 2021-08-09 10:24:54 -05:00
Richard Hughes
09770c60f0 trivial: Fork for 1_6_X 2021-08-09 09:24:03 +01:00
Richard Hughes
f42b44e427 Remove some deprecated API 2021-08-06 19:49:53 +01:00
Richard Hughes
a5a978b3f6 Rename some confusing API
More than one person has asked about 'why call fu_plugin_update() for a
reinstall or downgrade' and I didn't have a very good answer.

The plugin API is not officially stable, and we should fix things to be
less confusing. Use the same verbs as the FuDevice vfuncs instead.
2021-08-06 19:49:53 +01:00
Ricardo Cañuelo
14d21c941c trivial: Allow handling EPROTO in plugins
Signed-off-by: Richard Hughes <richard@hughsie.com>
2021-08-05 15:46:06 +01:00
Richard Hughes
12842fdfce Fall back to the parent if the child does not have a battery level set 2021-08-04 09:29:02 +01:00
Richard Hughes
05c1f2b1f3 trivial: Fix docgen warning that crept in with FwupdRequest 2021-08-03 17:33:21 +01:00
Richard Hughes
8f19ea75d3 Sanitize the device name harder 2021-08-03 15:45:37 +01:00
Richard Hughes
4daaabe451 trivial: Do not log a scary warning for the common case 2021-07-30 18:53:30 +01:00
Richard Hughes
3b919fc38d trivial: Actually use USE_PARENT_FOR_OPEN for close as the docs say
This fixes updating the Synaptics prometheus hardware.
2021-07-30 18:53:30 +01:00
Richard Hughes
d8f9b66e0e trivial: Actually use the right USE_PARENT_FOR_OPEN flag 2021-07-30 18:53:30 +01:00
Richard Hughes
5f7e58b395 Revert "trivial: Ignore the NUL suffix to fix loading new firmware"
This reverts commit a8d73369f7.

“No matter how far you have gone on the wrong road, turn back.”
2021-07-30 13:42:41 +01:00
Richard Hughes
a8d73369f7 trivial: Ignore the NUL suffix to fix loading new firmware
The LVFS is now adding an artificial NUL to the metainfo data to work
around a possible buffer over-read on old fwupd versions. This breaks
new code that reads the XML buffer using xb_builder_source_load_bytes
as GLib then tries to parse the final NUL byte.

As `xmllint` actually ignores the trailing NUL, we should as well.
2021-07-29 20:07:22 +01:00
Richard Hughes
3747e245e5 uefi-capsule: Add support for CapsuleOnDisk
Based on a patch by Ilias Apalodimas <ilias.apalodimas@linaro.org>,
many thanks.

Fixes https://github.com/fwupd/fwupd/issues/2900
2021-07-28 17:11:39 +01:00
Richard Hughes
0efa97229a Automatically clear the update error as required
This is less fragile than patching all the callers.
2021-07-23 13:16:47 +01:00
Richard Hughes
ae48e02ac2 Do not assume the metainfo file is NUL-terminated
This was only true by accident. We'll need another fix for the LVFS to
add the missing NUL to restore compatibility for older clients.

Fixes https://github.com/fwupd/fwupd/issues/3533
2021-07-23 11:58:56 +01:00
Peter Marheine
464425fb5c SMBIOS: try reading from /sys/class/dmi if direct access fails
The raw SMBIOS tables that Linux exposes in /sys/firmware/dmi
are restricted to being readable by root only. If running as
non-root access is still permitted by fields that have been
pre-parsed by the kernel in /sys/class/dmi, most of which are
world-readable. This allows the daemon to load most HWIDs even
if running as a non-root user, as is done on Chromium OS.
2021-07-23 09:46:45 +01:00
Richard Hughes
f2fd6b0717 trivial: Do not save the self test quirk silo to disk
This also speeds up the tests as the amount of pointless i/o is reduced.

Fixes https://github.com/fwupd/fwupd/issues/3522
2021-07-22 12:51:47 +01:00
Richard Hughes
55f6fd435a Add a ->get_results() vfunc that can be used by subclasses of FuDevice 2021-07-22 12:47:54 +01:00
Mario Limonciello
798d1ed3ee trivial: update markdown for pre-commit style 2021-07-18 14:42:47 -05:00
Richard Hughes
15b668c0c6 Open the device proxy in the engine where required
The benefit of using the proxy device is that we can 'use' the proxy
device for device access, but 'report' the progress on the passed
FuDevice instance.

This means the front-end reports the device status correctly when
updating composite devices that us proxies.

The comment always said we should move it to the daemon if another
plugin started doing this, and that is now.
2021-07-17 17:20:01 +01:00
Richard Hughes
942802063e trivial: Remove the unused parent instance from the private struct
I assume at some point we forgot to remove it when converting an object
from FINAL to DERIVABLE and the anti-pattern just got copied around the
codebase...
2021-07-15 16:20:19 +01:00
Richard Hughes
a65f5759ef trivial: Fix a typo of fwupd itself 2021-07-15 09:33:25 +01:00
Richard Hughes
19abf996c7 Allow the daemon to request interactive action from the end user
The "return error and hope the client resubmits the firmware again"
pattern is clunky. There are two plugins doing this now, and about to
be one more.

This adds FwupdRequest which provides a structured way of asking the
user to perform an action, e.g. to replug the device or to press a
special key or button.

This replaces much of the UpdateMessage and UpdateImage API although
it is still used internally. Clients capable of processing the new
DeviceRequest signal should add REQUESTS to their feature flags.

Also, this allows us go back to the old meaning of _NEEDS_BOOTLOADER,
which was "needs rebooting into a bootloader mode" rather than the
slightly weird "user needs to do something and resubmit request".
2021-07-14 17:03:50 +01:00
Ivan Mikhanchuk
5e04fae8f2 Add functions to read from and write to FU_PATH_KIND_FIRMWARE_SEARCH 2021-07-13 21:57:08 +01:00
Mario Limonciello
da895169a7 Add a new path for configuring runtime firmware load path
The kernel allows configuring this, and certain plugins will use this
path to be able to load firmware in the kernel driver through runtime,
but to flash to the device.
2021-07-13 21:57:08 +01:00
Richard Hughes
89064bf410 trivial: Downgrade a warning to avoid a lot of extra code 2021-07-12 19:01:55 +01:00
Richard Hughes
b2ee236060 trivial: Show a critical warning if a device has no context 2021-07-12 19:01:55 +01:00
Richard Hughes
d938ab62e6 trivial: Add fu_device_add_guid_full() to control behaviour 2021-07-12 19:01:55 +01:00
Richard Hughes
53538685fc trivial: Add FU_DEVICE_INSTANCE_FLAG_NO_QUIRKS to avoid quirk matches 2021-07-12 19:01:55 +01:00
Richard Hughes
9c31d1fadd trivial: Set the FuContext on more devices 2021-07-12 19:01:55 +01:00
Richard Hughes
488f2e1f37 Export the EFI and IFD parsers
We'll need to use this from another plugin soon.
2021-07-12 10:33:38 +01:00
Richard Hughes
0cc06f032c Add a flag to open and close with the parent device
This is a common pattern that is used in lots of plugins, so move the
logic into common code.
2021-07-11 16:37:47 +01:00
Richard Hughes
a84b76573a trivial: Set the remove delay on the child automatically 2021-07-10 07:37:59 +01:00
Richard Hughes
3b84bb2135 trivial: Set the backend ID on children if unset
This allows children of devices that derive from FuUdevDevice to be
removed correctly.
2021-07-10 07:37:59 +01:00