Commit Graph

152 Commits

Author SHA1 Message Date
Richard Hughes
cf9ebdb703 Add startup profiling functionality
Using `sudo FWUPD_PROFILE=10 ./src/fwupd --verbose` will print a
dump of startup times onto the console so that we can debug which
plugin is slowing down system startup. For example:

    ../src/fu-engine.c:5409:plugins-coldplug [108.55ms]:
        ../plugins/amt/fu-plugin-amt.c:437:amt [27.14ms]:
            :create-context [12.66ms]
            :get-version [8.44ms]
            :add-device [3.95ms]
2022-06-14 22:08:02 +01:00
Richard Hughes
30aab6f564 Copy the instance ID strings when incorporating
Also, add a test.
2022-06-14 21:01:57 +01:00
Richard Hughes
d4d0ba0faf Unexport fu_common_cab_build_silo()
There's no reason this needs to be in the shared library.
2022-06-14 14:36:52 -05:00
Richard Hughes
3eaa907534 Remove the now unnecessary fu_smbios_to_string() 2022-06-14 14:36:52 -05:00
Richard Hughes
fc2da47b69 Remove fu_strtoull_full() 2022-06-14 14:36:52 -05:00
Richard Hughes
4105768a01 Remove the 'common' prefix when parsing version numbers 2022-06-14 14:36:52 -05:00
Richard Hughes
3e0a4dc1c3 Be smarter and include less header files per source file 2022-06-14 14:36:52 -05:00
Richard Hughes
7f86ffab6f Split out the dump helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
72ca59653e Unexport fu_common_uri_get_scheme()
We don't want plugins to be using this.
2022-06-14 14:36:52 -05:00
Richard Hughes
2c5e4ff3ab Unexport fu_common_firmware_builder()
We don't want plugins to be using this.
2022-06-14 14:36:52 -05:00
Richard Hughes
3f77af3cd4 Split out the kernel helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
fd9b9db5b3 Unexport fu_common_instance_id_strsafe()
We want plugins to use the instance ID builder instead now.
2022-06-14 14:36:52 -05:00
Richard Hughes
25dccf09f7 Unexport fu_common_spawn_sync()
This isn't something we want plugins to use.
2022-06-14 14:36:52 -05:00
Richard Hughes
425fedcca1 trivial: Remove fu_byte_array_set_size_full() 2022-06-14 14:36:52 -05:00
Richard Hughes
ed1b13da28 Split out the memory helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
4b1313b406 Split out the GByte helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
9d33c29e92 Split out the string helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
3fe9c0de34 Split out the CRC and sum functions to new source files 2022-06-14 14:36:52 -05:00
Richard Hughes
9b29d70f31 Add a progress flag to indicate for when the child returns early
Using `fu_progress_finished(fu_progress_get_child(progress))` is IMHO
a hacky workaround.
2022-06-14 14:31:19 +01:00
Richard Hughes
e6b487e762 Add FuProgress to ->startup() and ->coldplug()
This allows us to profile the daemon startup so we can find any plugins
taking an inordinate amount of time to start.
2022-06-04 20:21:50 +01:00
Richard Hughes
dc91d59f8e Remove the recently added fu_progress_add_step_full()
Just break API instead.
2022-06-03 13:47:11 -05:00
Richard Hughes
4ee6cce9b8 Remove some duplicated unsafe API 2022-06-03 13:47:11 -05:00
Richard Hughes
517dc88f4f trivial: Fix the win32 CI tests 2022-05-06 13:55:51 +01:00
Richard Hughes
beb49d7ac0 trivial: Add fu_common_read_uint24() helper for future code 2022-04-28 14:18:30 +01:00
Richard Hughes
855ece352d Check the alignment when reading in raw firmware 2022-04-28 14:15:49 +01:00
Richard Hughes
0b7af7d54b trivial: Ignore the return value of setenv() in most cases
This makes Coverity happy.
2022-04-13 15:08:12 +01:00
Mario Limonciello
3006d238d6 Automatically obsolete negative duplicate attributes
To a user there is no point to explicitly showing two failures for
encrypted RAM if the system supports SME and TSME both.

To show them a single failure, de-duplicate the attributes by appstream
ID during depsolve.

If the plugin didn't explicitly set obsoletes and two attributes are both
failures and both share the same appstream ID obsolete one of them.
2022-04-12 11:59:49 -05:00
Richard Hughes
dcd39d80a7 Add the CFI quirks in setup() so the device can be open 2022-03-31 12:47:13 +01:00
Richard Hughes
5817ef3b4f Emit 0% in FuProgress to show the child has started
This prevents showing the 'old' percentage until the first sub-task has
completed for some device firmware updates.
2022-03-29 20:04:26 +01:00
Richard Hughes
6b5d933e99 Do not show unconnected or unreachable devices in the client tools
Fixes https://github.com/fwupd/fwupd/issues/4378
2022-03-15 14:08:17 +00:00
Daniel Campello
61226b49f3 fwupdplugin-self-test: fix spawn tests for qemu
Wrap the spawned script with an explicit call to the /bin/sh
interpreter needed when running tests in a cross compiled enviroment.

Also increase the timeout for the spawned script to execute to give
enough time for the print to happen in the much slower virtualized
environment.

Change-Id: I71ed377e1bc8db4be4c522cdb9562c1662df7266
2022-03-09 17:32:40 -07:00
Richard Hughes
adfef91731 trivial: Strip leading and trailing spaces from the vendor name 2022-02-24 17:07:44 +00:00
Richard Hughes
308e03a6f4 Sanitize the instance ID parts more carefully
The only users of `SERIO\FWID` and `I2C\NAME` are already 'safe' and
the device GUIDs should all be unchanged.

There are no current users of the `MTD\NAME` instance IDs, and these
are the ones that may be more unpredictable and in need of sanity.
2022-02-18 08:23:39 +00:00
Richard Hughes
55bd4862d3 Try harder to convert to a version into a correct semver
This is really useful for the flashrom plugin.
2022-02-11 15:28:05 +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
Crag Wang
b728608baa Show results when calling get-details if failing requirements 2022-01-19 12:10: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
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
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
Gaël PORTAY
428f3d5b99 Add block size properties to FuCfiDevice 2021-12-15 17:49:32 +00:00
Richard Hughes
52fd89f9ab Add fu_memmem_safe() with fallback code for win32 2021-12-15 12:57:49 +00:00
Richard Hughes
b2048820aa Copy private flags from donor devices 2021-12-13 15:21:51 -06: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
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
ae278e1b80 Be case insensitive when fixing the device model 2021-11-09 16:09:16 +00:00
Richard Hughes
7453d59ccf trivial: Fix a small memory leak in the self tests 2021-10-27 15:57:53 +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
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