Commit Graph

708 Commits

Author SHA1 Message Date
Richard Hughes
171ebda355 Check the IFD sections have non-zero data length
This fixes a critical warning when loading an invalid builder file.
2022-02-09 13:31:55 +00:00
Richard Hughes
8cec5d8686 Allow padding firmware sections in builder XML files 2022-02-09 13:31:55 +00:00
Richard Hughes
2448660922 trivial: Print the RemoveDelay in the device debug string 2022-02-07 14:21:01 +00:00
Richard Hughes
24c041c3f8 trivial: Fix the range check for the RemoveDelay quirk 2022-02-07 14:21:01 +00:00
Richard Hughes
2fd4ea5ddc Get the SMBIOS table on Windows
Fixes https://github.com/fwupd/fwupd/issues/4253
2022-02-07 14:04:44 +00:00
Richard Hughes
75b68ed9f9 trivial: Allow NULL @error for fu_device_retry_full()
The docs say `(nullable)` and it's the only function that seems to hard require
an error, for no good reason I can see.
2022-02-01 16:18:28 +00:00
Richard Hughes
6f87fc5ee3 trivial: Fix 'fwupdtool firmware-sign' by removing debugging 2022-01-31 10:57:10 +00:00
Richard Hughes
b9960095b8 trivial: Fix the FreeBSD build
Mea culpa. Fixes https://github.com/fwupd/fwupd/issues/4225
2022-01-27 20:35:41 +00:00
Richard Hughes
f966dfe251 Fall back to the Device Tree 'compatible' data as required
This allows us to use CHID requirements on the PinePhone, and
potentially other hardware too.

See https://github.com/fwupd/fwupd/discussions/4209
2022-01-24 21:30:15 +00:00
Richard Hughes
38bab8fc4f Allow overriding daemon parameters using /var/etc/fwupd/daemon.conf
This is super useful for debugging immutable systems like ChromeOS.
2022-01-21 11:52:06 +00:00
Crag Wang
b728608baa Show results when calling get-details if failing requirements 2022-01-19 12:10:52 +00:00
Richard Hughes
ca43733a8c Show why devices are not marked as updatable
At the moment a lot of the failures are only visible when running the
daemon in verbose mode, and the inhibit functionalit provides us a way
to unset FWUPD_DEVICE_FLAG_UPDATABLE from multiple places, as well as
setting the update error for the user to see why.
2022-01-13 12:40:56 +00:00
Richard Hughes
45673e7d9f trivial: Show results when using FWUPD_XMLB_VERBOSE 2022-01-12 16:16:52 +00:00
Richard Hughes
1ef67c60ca Only accept GUIDs when calling fu_quirks_lookup_by_id()
The only place we were using the instance ID -> GUID conversion was in
the self tests, and assuming the group is always a GUID removes a lot
of checks from a very hot path at startup.
2022-01-12 16:16:52 +00:00
Richard Hughes
c74c0ab655 trivial: Fix builds with -Dgusb=false 2022-01-11 09:40:57 +00:00
Richard Hughes
dbdb207561 Increase the chances of success of WAIT_FOR_REPLUG on WIN32
Decrease the GUsb polling interval when any of the devices is in
`WAIT_FOR_REPLUG` on when running on Windows. Any device that can
re-enumerate much faster than the default 1000ms may be missed and the
detach may fail.

Linux doesn't have this problem as it has `LIBUSB_CAP_HAS_HOTPLUG`.
2022-01-06 13:20:34 -06:00
Richard Hughes
25b1813069 trivial: Fix up some clang-format issues that snuck in recently 2022-01-06 17:04:34 +00:00
Richard Hughes
e70f2df7f7 trivial: Fix some recently added gtk-doc markup 2022-01-05 09:51:45 +00:00
Richard Hughes
f885ab6d2a Allow patching firmware files at known offsets
This allows us to replace the 'dfu-tool replace' with a much more
controlled 'fwupdtool firmware-patch' command that patches at a set of
specific offsets.

Drop in the new functionality into the existing firmware ->write()
vfuncs so that the image headers, footers and/or checksums are correct.
2022-01-05 09:51:45 +00:00
Richard Hughes
1c62194dd3 trivial: Fix fu_common_dump_full() header when specifying both flags 2022-01-04 22:06:33 +00:00
Richard Hughes
8df102b7c0 Add fu_usb_device_add_interface() for plugins to use
It's a common action for plugins to call FuUsbDevice->open() then claim
interfaces, and then release them just before FuUsbDevice->close().

It's also something a lot of plugins get wrong, so provide common code
to handle it correctly in one place.
2022-01-04 22:05:37 +00:00
Richard Hughes
c725e42e34 trivial: Fix various const issues 2022-01-03 22:46:23 +00:00
Richard Hughes
0816151045 trivial: Make fu_common_version_parse_from_format() NULL-safe 2022-01-03 22:46:23 +00:00
Richard Hughes
e17a107ce1 trivial: Cast the g_signal_connect() object to allow static analysis
This is useful when using https://gitlab.freedesktop.org/tartan/tartan
2022-01-03 22:46:23 +00:00
Richard Hughes
2e99055d1e trivial: Add some more annotations for language bindings 2022-01-03 22:46:23 +00:00
Richard Hughes
736a56ccee Use the UDev devtype for quirk matching 2021-12-30 16:35:04 +00:00
Richard Hughes
0c447b3c47 trivial: Show the quirk load path when debugging 2021-12-30 16:33:25 +00:00
Richard Hughes
7e640f81e5 trivial: Fix build warnings when compiling on Windows 2021-12-30 15:18:22 +00:00
Richard Hughes
c9a915a579 trivial: Print all the inhibits in the --verbose output 2021-12-29 19:18:26 +00:00
Richard Hughes
f76880182f Do not allow UEFI updates when the lid is closed
Most vendors do not mirror the firmware update to an external display,
and some don't behave correctly when the lid is shut and the machine is
docked. Add this quirk just for Lenovo for now.

Fixes https://github.com/fwupd/firmware-lenovo/issues/181
2021-12-29 19:18:26 +00:00
Richard Hughes
8e6a3f6bbb Allow devices to opt-in to metadata-provided vendor strings 2021-12-22 15:34:36 +00:00
Richard Hughes
60d266cbc6 Add support for UF2 devices
A UF2 device exposes a VFAT block device (sometimes called a Mass
Storage Device) which has a virtual file called `INFO_UF2.TXT` where
metadata can be read. It may also have a the current firmware exported
as a file called `CURRENT.UF2` which is in a 512 byte-block UF2 format.

Writing any file to the MSD will cause the firmware to be written.
Sometimes the device will restart and the volume will be unmounted
and then mounted again. In some cases the volume may not “come back”
until the user manually puts the device back in programming mode.

Match the block devices using the VID*PID, UUID or label, and then
create a UF2 device which can be used to flash firmware.

Note: We only read metadata from allow-listed IDs to avoid causing
regressions on non-UF2 volumes. To get the UUID and label you can
use commands like:

    udisksctl info -b /dev/sda1
2021-12-21 10:06:18 +00:00
Mario Limonciello
17db067d13 libfwupdplugin: add a helper to set a config file to secure 2021-12-17 11:05:05 -06:00
Gaël PORTAY
53ed50e1c9 Add block erase command to FuCfiDevice 2021-12-15 17:49:32 +00:00
Gaël PORTAY
428f3d5b99 Add block size properties to FuCfiDevice 2021-12-15 17:49:32 +00:00
Richard Hughes
bcf000d7cc Add fu_common_get_contents_stream() for future usage 2021-12-15 14:24:30 +00:00
Richard Hughes
52fd89f9ab Add fu_memmem_safe() with fallback code for win32 2021-12-15 12:57:49 +00:00
Mario Limonciello
0b56a58b65 trivial: win32: fix subprocess call
```
19:22:39:0430 FuCommon             running 'curl.exe https://cdn.fwupd.org/downloads/firmware.xml.gz.jcat --output C:\Users\mlimonci\AppData\Local\Microsoft\Windows\INetCache\fwupd\firmware.xml.gz.jcat --cacert C:\Program Files (x86)\fwupd\bin\..\bin\ca-bundle.crt'
19:22:39:0515 GLib-GObject         invalid cast from 'GWin32InputStream' to 'GPollableInputStream'
19:22:39:0515 GLib-GIO             g_pollable_input_stream_create_source: assertion 'G_IS_POLLABLE_INPUT_STREAM (stream)' failed
19:22:39:0516 GLib                 g_source_attach: assertion 'source != NULL' failed
19:22:39:0516 GLib                 g_source_set_callback: assertion 'source != NULL' failed
```
2021-12-15 06:46:27 -06:00
Mario Limonciello
12bdc7d3ad trivial: win32: discover the running directory
This should allow launching fwupdtool.exe from anywhere outside
of PATH
2021-12-15 06:46:27 -06:00
Mario Limonciello
4960ae34ba trivial: win32: discover user's profile directory
For anything that is normally in /var on Linux, write it
here so that users don't need admin rights.
2021-12-15 06:46:27 -06:00
Richard Hughes
b2048820aa Copy private flags from donor devices 2021-12-13 15:21:51 -06:00
Richard Hughes
2d9d93ec76 trivial: Prevent critical warning when calling fu_chunk_array_new() on zero-sized data 2021-12-12 11:16:03 +00:00
Richard Hughes
179f250b9a trivial: Properly namespace _INTERNAL_FLAG_NO_AUTO_REMOVE 2021-12-10 17:25:54 +00:00
Richard Hughes
afb09fa2fa trivial: Add a missing error check when creating a stream 2021-12-10 16:00:07 +00:00
Richard Hughes
a561b1a8ba Make the plugin startup order deterministic
At the moment only the order is considered, and the rest is unspecified
by the filesystem.
2021-12-10 15:58:11 +00:00
Richard Hughes
346baab909 trivial: Fix CFI header to match reality 2021-12-10 15:00:10 +00:00
Richard Hughes
f9a7bcae0a Add page and sector size properties to FuCfiDevice 2021-12-09 13:09:43 +00:00
Richard Hughes
58d36dcbe5 Check the value range when parsing the quirk keys
At the moment there isn't an error if you enter something like

    CfiDeviceCmdReadId = 0×12
2021-12-09 13:09:43 +00:00
Richard Hughes
f5f3e244c9 trivial: Allow quirking all CFI commands 2021-12-09 13:09:43 +00:00
Richard Hughes
c877593803 Add the CFI JEDEC instance ID if using vendor-extended version
Setting a flash ID of `C84016` would then add `CFI\FLASHID_C84016` and
also `CFI\FLASHID_C840`. This makes it easier to write quirks.
2021-12-09 13:09:43 +00:00