Commit Graph

665 Commits

Author SHA1 Message Date
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
Richard Hughes
e87fc05ab9 Speed up the daemon startup by ~2% by doing dlsym much less
We were calling g_module_symbol() 2703 times, which is actually more
expensive than you'd think.

It also means the plugins are actually what we tell people they are:
A set of vfuncs that get run. The reality before that they were dlsym'd
functions that get called at pretty random times.
2021-11-09 12:02:07 +00:00
Richard Hughes
eb508129a8 trivial: Remove devices already added on failed coldplug
Calling into the now-disabled makes things very tricky to debug.
2021-11-09 07:42:05 +00:00
Richard Hughes
764df76d34 Allow overriding the firmware GType from a quirk file
This also allows us to remove quite a lot of boilerplate from plugins.
2021-11-08 15:53:41 +00:00
Richard Hughes
36d7077f65 Add a new plugin to handle MTD devices 2021-11-05 20:01:51 +00:00
Richard Hughes
ed419416d5 Allow setting the FuUdevDevice bind-id at runtime 2021-11-05 15:00:10 +00:00
Richard Hughes
1507055849 trivial: Use GObject notify when modifying the proxy 2021-11-05 12:00:48 +00:00
Richard Hughes
02222a58c8 trivial: Add FU_UDEV_DEVICE_FLAG_OPEN_SYNC for future code 2021-11-05 08:01:25 +00:00
Richard Hughes
0fb2ef3aae trivial: Add fu_udev_device_seek() for future code 2021-11-05 08:01:25 +00:00
Richard Hughes
fe180cbf5d trivial: Add fu_udev_device_get_sysfs_attr_uint64() for future code 2021-11-05 08:01:25 +00:00
Richard Hughes
a32773efab Use indexes with the XPath query to speed up startup by 2% 2021-11-04 10:09:17 +00:00
Richard Hughes
04d9f8c722 Use prepared queries for quirk lookup to speed up startup by 5%
We were already using xb_value_bindings_bind_str(), but recreating the
query object each time -- which kinda defeats the purpose...
2021-11-04 10:09:17 +00:00
Richard Hughes
1a077289bc Speed up daemon startup by 15%
During my fwupd startup fu_plugin_has_custom_flag gets called 21 times
which causes all HWIDs to be enumerated with 346 calls to the quite
expensive fu_context_lookup_quirk_by_id() function.

Move the flag to a private hashset and enumerate the HWIDs only during
startup. There's nothing plugin specific about them anyway...
2021-11-03 07:14:37 +00:00
Richard Hughes
74cb7a23d1 Fix 'fwupdmgr security' on a fresh install
If there are no HSI events then don't throw a critical warning when the
variant array type is unknown.
2021-11-01 10:14:43 +00:00
Richard Hughes
196dbec5ae trivial: Add fu_security_attrs_append_internal() for future code 2021-10-29 13:11:21 +01:00
Richard Hughes
5bb250846d trivial: Fix recently introduced gtkdoc warning 2021-10-29 11:38:04 +01:00
Richard Hughes
7453d59ccf trivial: Fix a small memory leak in the self tests 2021-10-27 15:57:53 +01:00
Richard Hughes
0d64780093 trivial: Fix a small memory leak when getting volumes 2021-10-27 15:57:53 +01:00
Richard Hughes
b3e7f07716 trivial: Use ->dispose() to remove a ref-loop at exit 2021-10-27 15:57:53 +01:00
Jason Gerecke
835975d66c trivial: Add "full" CRC8 function
The CRC32 and CRC16 algorithms have "full" functions that allow callers to
provide their own polynomial and initial CRC value. Provide the same ability
to users of the CRC8 algorithm.
2021-10-26 18:15:23 +01:00
Richard Hughes
28678235cd Move the fuzzing files into the plugin directories
We only had to pile everything into the src/fuzzing/firmware directory
because honggfuzz could not cope with more than one input path.

This way each plugin is self contained and easy to copy.
Also, install the fuzzing builder objects as this fixes the installed
tests when srcdir does not exist.

Based on a patch by Jan Tojnar <jtojnar@gmail.com>, many thanks.
2021-10-22 15:24:05 +01:00
Richard Hughes
3a63f5bd9b trivial: Make the SREC parser more spec compliant
Only upgrade S5 into S6 when there are over 0xFFFF records.
2021-10-22 14:58:24 +01:00
Richard Hughes
2d00cda464 Remove PLUGINBUILDDIR and use G_TEST_SRCDIR and G_TEST_BUILDDIR instead
This allows us to override the location we load data files from, which
allows us to do more kinds of installed tests in the future.

Also, move the global data/tests content into the place that it is used
as it was getting impossible to manage.
2021-10-21 18:36:22 +01:00