Commit Graph

687 Commits

Author SHA1 Message Date
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
Kranthi Kuntala
de1f971e14 thunderbolt: set ports offline on host controller
This change offline ports in the host controller
for retimers to enumerate in the NDA case.

-offline and rescan usb4 ports
-this enable enumeration of the retimers
-updates nvm to the enumerated retimers
-online usb4 port this will de-enumerate retimers

BUG=b:187506425
TEST=emerge-volteer fwupd

Signed-off-by: Kranthi Kuntala <kranthi.kuntala@intel.corp-partner.google.com>
2021-12-07 15:54:30 +00:00
Gaël PORTAY
acb4d6e2ce trivial: cfi: Fix up a typo 2021-12-07 10:17:54 +00:00
Richard Hughes
eab72f8b6e trivial: Verify backends never add or remove from a thread 2021-12-06 17:57:23 +00:00
Richard Hughes
1784a0aca5 trivial: Do not check the device superclass when closing
The things we're closing is probably a FuUsbDevice subclass which has
the GUsbDevice as an instance variable, not a subclass of GUsbDevice.
2021-12-02 16:21:29 +00:00
Richard Hughes
165c0278bb trivial: Fix a warning when compiling without USB support 2021-11-27 20:28:13 +00:00
Richard Hughes
91dc36cba7 trivial: Don't reset the status when calling fu_progress_finished() 2021-11-27 07:22:50 +00:00
Richard Hughes
cadb2af031 trivial: Never print NULL in the FuFirmware flag output 2021-11-26 15:33:32 +00:00
Richard Hughes
3ffc3fa774 Add fu_common_sum8() common functionality
We now have 9 different plugins all using this functionality, and we're
about to add one more. Move this into common code so that all the
plugins are using the same endian and bufsz-safe versions.
2021-11-26 18:33:11 +03:00
Richard Hughes
7143e04852 Add FuArchiveFirmware
Add a FuFirmware superclass that allows us to parse an new archive in the archive. We already do this for fastboot and we're about to add another.
2021-11-26 13:47:04 +00:00
Richard Hughes
0e175181ea Do not leak when calling fu_firmware_parse() multiple times 2021-11-24 15:46:18 +00:00
Richard Hughes
019a210c94 Show an error when loading XML with multiple <component> tags
Fixes https://github.com/fwupd/fwupd/issues/4022, but requires a newer
libxmlb to be installed.
2021-11-24 15:44:56 +00:00
Mario Limonciello
b70d3a73e8 trivial: Fix style for fu-fuzzer-firmware.c
This was skipped because pre-commit identified c.in as text not C.
2021-11-17 16:19:41 +00:00
Richard Hughes
40c7f7ba21 Show a daemon warning if quirk flags are malformed 2021-11-17 15:14:13 +00:00
Richard Hughes
fedce9e077 trivial: Crash the fuzzer on critical warning
We want to abort early rather than relying on other problems like segfault or OOM.
2021-11-17 15:13:56 +00:00
Richard Hughes
2958586d50 trivial: Add some debugging when a private flag does not match 2021-11-15 16:40:27 +00:00
Richard Hughes
60612294f5 trivial: Use the device GType as the debugging root
We never show the fu_device_to_string() output to the user in normal
circumstances, and it's super useful for it to match the FuFirmware
format.
2021-11-15 14:59:52 +00:00
Richard Hughes
fca20c0722 trivial: Fix the progress status when required
When the child has completed we rely on the next fu_progress_step_done()
call to set the status value back to the parent-defined value. In the
case where there is a delay until the next step is done (e.g. waiting
for hardware to re-enumerate) the child status persisted incorrectly.
2021-11-15 14:59:37 +00:00
Richard Hughes
4f3e2c3a57 Allow overriding HwId data from the config file
To use this on a immutable system like ChromeOS you can create a file
in /var/lib/fwupd/daemon.conf which is used as an override.
2021-11-10 17:59:52 +00:00
Richard Hughes
c1f7ac47e8 tpm: Actually add the v1.2 device
Also, add end-to-end tests for this so it can never happen again.

Fixes https://github.com/fwupd/fwupd/issues/3972
2021-11-10 14:08:08 +00:00
Yehezkel Bernat
86286c3efd trivial: remove outdated comment
This comment became outdated with #3940, where the `NULL` check for `priv->ctx` that followed by early return was removed
2021-11-09 20:20:03 +00:00
Richard Hughes
ae278e1b80 Be case insensitive when fixing the device model 2021-11-09 16:09:16 +00:00