Commit Graph

238 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
2dc6a7ef73 Remove fu_i2c_device_read_full()
Just use the version with the length specified.
2022-06-14 14:36:52 -05: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
377bcb718f Remove the 'common' prefix from the volume creation methods 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
1d9d82ebc5 Use a common prefix for CPU-specific methods 2022-06-14 14:36:52 -05:00
Richard Hughes
067d7d8088 Split out the path helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
770a452132 Unexport fu_common_error_array_get_best()
Plugins should not be using this.
2022-06-14 14:36:52 -05:00
Richard Hughes
14cc9b2064 Unexport fu_common_reverse_uint8()
It's only used in one little-used plugin.
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
518ba8b6f7 Unexport fu_common_realpath()
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
f759569a9f Unexport fu_common_extract_archive()
We have a FuFirmware helper now, which doesn't use a temp dir.
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
dc91d59f8e Remove the recently added fu_progress_add_step_full()
Just break API instead.
2022-06-03 13:47:11 -05:00
Richard Hughes
f9e6aa16a3 Remove some deprecated API 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
d6fd08e3a5 Remove some deprecated API 2022-06-03 13:47:11 -05:00
Richard Hughes
0cbcac93cd Rename fu_udev_device_ioctl_full() as we broke ABI 2022-06-03 13:47:11 -05:00
Richard Hughes
029d2895bd Rename fu_udev_device_pread_full() as we broke ABI 2022-06-03 13:47:11 -05:00
Richard Hughes
5ef0ae182d Add a 'name' attribute to each FuProgress step
This allows us to print better warning strings, and in the future
would allow us to profile each operation in a meaningful way.

Also, add context to some of the progress steps as required.
2022-06-01 15:05:43 +01:00
Gaël PORTAY
e6b01cbb18 archive: Add writing support 2022-05-21 08:21:55 -04:00
Richard Hughes
8ebad4ea75 Specify an enumerated problem when inhibiting devices
This allows us to make smarter policy decisions in the future on when
to show unavailable updates. It also means we can show translated
text in the frond-end clients.

Only problems the user can "fix" are enumerated. For example, opening
the laptop lid, or charging the device battery.
2022-05-19 13:09:03 -05:00
Richard Hughes
c0a668ab18 Allow the device to pause the polling when writing firmware 2022-05-10 18:51:17 +01:00
Richard Hughes
d3d7cfa816 Add plugin quirk keys earlier in the startup process
This allows creating the silo when starting the engine with custom
plugin keys such as WacomI2cFlashBaseAddr.

If we move the plugin initialization earlier then we don't get the
HwID matches, so we really do have to split this into a 4-stage startup,
e.g. ->load(), ->init(), ->startup() and ->coldplug().
2022-05-09 11:13:52 +01:00
Richard Hughes
2fcdf352df Retry the device ioctl for EAGAIN 2022-04-29 15:01:32 +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
f3ec632492 trivial: Add some new helper API for future functionality 2022-04-26 14:30:28 +01:00
Richard Hughes
a8497ad5c2 trivial: Allow invalidating backends when subsystems change 2022-04-15 16:49:48 +01:00
Richard Hughes
91e9f359c3 Add a plugin for the CH341A device 2022-04-03 16:29:30 +01:00
Richard Hughes
f042bbd42c Add fu_common_reverse_uint8() for future functionality 2022-03-31 16:34:27 +01:00
Richard Hughes
92515d193a Add coSWID and uSWID parsers to libfwupdplugin
These parse the structures as defined in:

 * https://datatracker.ietf.org/doc/draft-ietf-sacm-coswid/
 * https://github.com/hughsie/python-uswid
2022-03-15 14:37:02 +00: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
Richard Hughes
c4ca026294 Allow devices to build instance IDs more easily
Provide a device instance builder that allows plugins to easily
create multiple instance IDs based on parent attributes.

Also fix a lot of the instance ID orders, so that we add more generic
IDs first, and more specific IDs after.
2022-03-03 09:13:29 +00:00
Richard Hughes
bd02edcc43 trivial: Add missing API wrapper for future functionality 2022-02-21 18:57:20 +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
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
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
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