Commit Graph

881 Commits

Author SHA1 Message Date
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
3e0a4dc1c3 Be smarter and include less header files per source file 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
2822d724b2 Unexport the nearly-unused FuAppFlags 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
c6581fb7a6 Split out the GByteArray 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
b3f69c1c47 scsi: Use the SCSI target to correctly set the physical ID
We don't want to include the SCSI LUN in the physical ID, as this is a
logical concept not relating to the hardware device.

Use the UDev devtype to find the 'correct' parent.
2022-06-11 11:06:01 +01:00
Richard Hughes
4c3a35c842 trivial: Fix a weird win32 compile failure
Windows is defining `interface` as a keyword when including headers.
2022-06-08 15:41:11 +01:00
Richard Hughes
114a08f0b6 Allow quirk entries to add multiple items 2022-06-08 15:15:53 +01:00
Richard Hughes
165ce50614 Revert "Speed up daemon startup by 650ms"
This reverts commit a7642a7b7e.

I forgot that we need the TYPE, DRIVER and most importantly subsystem
for PossiblePlugin quirk matches. We need something more subtle.
2022-06-08 07:56:45 +01:00
Gaël PORTAY
407ce2655c trivial: Add quirk definitions for CFI
This adds the missing definitions for the CFI quirks.
2022-06-08 07:56:07 +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
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
7e62e5b0c9 Add a FuProgress to ->verify() 2022-06-03 13:47:11 -05:00
Richard Hughes
106d45dede Make the API porting document more useful 2022-06-03 13:47:11 -05:00
Richard Hughes
a7642a7b7e Speed up daemon startup by 650ms
Reading properties from drm_dp_aux1 and drm_dp_aux2 took 700ms, and
we're never going to match any GUIDs as the vendor and model IDs are
both unset.
2022-06-01 15:50:13 +01:00
Richard Hughes
f14e4f8b8d trivial: Do not require an ID to finish a progress object
The function might have returned (possibly with an error set) before
fu_progress_set_id() was called.
2022-06-01 15:05:43 +01: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
41cbf8aa18 progress: Inherit status from parent 2022-05-27 11:19:51 -04:00
Richard Hughes
a78f660363 Emit a critical warning when duplicating private flags 2022-05-26 11:55:32 +01:00
Richard Hughes
6c93fe8b13 trivial: Fix a tiny leak when reading archives 2022-05-26 11:49:47 +01:00
Richard Hughes
67c77d7ec1 trivial: Fix a gtk-doc warning on build 2022-05-25 09:02:50 +01:00
Richard Hughes
2319f19306 Allow a plugin to only use the RemoveDelay when waiting for replug
Only opt-in plugins that have been tested -- unconditionally enabling
this may cause regressions on devices like docks.

Fixes https://github.com/fwupd/fwupd/issues/4378
2022-05-24 19:52:04 +01:00
Richard Hughes
4df0d2176b trivial: Fix docstring for fu_archive_write() 2022-05-22 11:28:25 +01:00
Gaël PORTAY
f862b8c9f3 trivial: Fix typos 2022-05-21 13:49:36 -04:00
Gaël PORTAY
f64783a75b trivial: Rename local that is not related to firmware 2022-05-21 13:49:36 -04: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
Gaël PORTAY
d7ffd821ff bluetooth: Set version if REV has been set 2022-05-18 02:23:59 -04:00
Richard Hughes
679628c091 Move the battery attributes down into libfwupd
This allows us to show the current value and the threshold on the CLI
and in tools like gnome-firmware.
2022-05-18 07:16:07 +01:00
Richard Hughes
f06061701c Allow setting the quirk ID from the quirk entry
Allow the admin to override the inhibit(s) on devices using a similar
format to the other kvs. For instance, setting two different quirks and
clearing another could be done using:

Quirk = usb-blocked:Device defective,needs-reboot:Reboot system,not-authorized:

This also allows unsetting the quirk, which was impossible before as
`@value` was always non-NULL.
2022-05-17 16:54:01 +01: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
517dc88f4f trivial: Fix the win32 CI tests 2022-05-06 13:55:51 +01:00
Richard Hughes
5031ea2c6b trivial: Fix introspection warning when building docs 2022-05-06 08:38:01 +01:00
Richard Hughes
f6c6e98786 trivial: Include header needed for GetLastError() 2022-05-02 12:36:28 +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
855ece352d Check the alignment when reading in raw firmware 2022-04-28 14:15:49 +01:00
Richard Hughes
3553336eff trivial: Don't print a critical warning in fu_common_sum8_bytes()
If the size if zero, the buffer may be NULL.

Fixes: https://oss-fuzz.com/testcase-detail/5453386322935808
2022-04-28 07:24:00 +01:00
Richard Hughes
f3ec632492 trivial: Add some new helper API for future functionality 2022-04-26 14:30:28 +01:00
Richard Hughes
492563d5f2 trivial: Ignore the return value of g_strlcpy() when safe 2022-04-23 10:30:50 +01:00
Richard Hughes
a1517e4875 dfu: Use the correct icon automatically for USB webcams 2022-04-23 08:56:58 +01:00
Richard Hughes
519110b70e Support firmware with uSWID header version 2
This allows multiple coSWID objects to be saved into a uSWID firmware,
and adds support for Zlib compressed payloads.
2022-04-18 17:48:52 +01:00
Richard Hughes
2d5186622c Add FuProgress to ->prepare and ->cleanup
Some plugins were creating local versions (which were not attached to
the daemon progress in any way) as a workaround as they needed to do
actions that took a long time to complete.
2022-04-15 16:50:06 +01:00
Richard Hughes
a8497ad5c2 trivial: Allow invalidating backends when subsystems change 2022-04-15 16:49:48 +01:00
Richard Hughes
58fd419fb8 Do not clear the instance-id hash during ->setup()
Some plugins rely on adding more instance IDs after the device has been
added.
2022-04-15 06:49:51 +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
Richard Hughes
0d7d8b3240 trivial: Always call va_end() even in the error path 2022-04-13 15:08:12 +01:00
Richard Hughes
2883b577dc trivial: Fix a potential OOB write that can't actually happen 2022-04-13 15:08:12 +01:00
Mario Limonciello
65e3bc57c5 trivial: fix a logic error in obsolete calculation 2022-04-12 12:23:16 -05: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
f4fb625fba Set the context automatically when setting the device proxy 2022-04-11 15:36:13 +01:00
Sergii Dmytruk
4795ab3122 trivial: libfwupd,libfwupdplugin: fix typos in several comments
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-11 15:31:03 +01:00
Richard Hughes
633571fa99 trivial: Fix some 'Comparison of narrow type with wide type in loop condition' 2022-04-05 14:45:42 +01:00
Richard Hughes
91e9f359c3 Add a plugin for the CH341A device 2022-04-03 16:29:30 +01:00
Mario Limonciello
55af9a8238 trivial: return an error string rather than HSI number for missing data 2022-04-03 09:06:00 -05:00
Richard Hughes
18f3b927e0 Add some default size values to the CFI device 2022-04-01 19:35:36 +01:00
Richard Hughes
f042bbd42c Add fu_common_reverse_uint8() for future functionality 2022-03-31 16:34:27 +01:00
Richard Hughes
356bd2fa5e Use the CFI manufacturer ID to set the vendor 2022-03-31 15:44:54 +01:00
Richard Hughes
ea9dd851af trivial: Add a missing possible CFI quirk key 2022-03-31 15:44:54 +01: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
b3e1b74d21 trivial: Use the proxy physical ID automatically 2022-03-31 09:59:33 +01:00
Richard Hughes
691166d203 trivial: Use a short string form for the CFI commands 2022-03-30 18:45:49 +01:00
Richard Hughes
04f00e8a17 trivial: Never return the invalid value from fu_progress_get_percentage() 2022-03-30 18:42:01 +01:00
Richard Hughes
16edfd345e Correctly probe USB-2 hubs with more than 7 ports
See https://github.com/fwupd/fwupd/pull/4426#discussion_r836155609
2022-03-30 07:09:26 +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
c1ff3e67af trivial: Fix a small memory leak when getting the udev parent 2022-03-25 21:12:53 +00:00
Richard Hughes
41bc319331 trivial: Fix -Wundef warning when compiling without libcbor 2022-03-18 10:38:12 +00:00
Richard Hughes
da37d93eb0 trivial: Remove some long dead docs about fu_plugin_device_add_delay() 2022-03-16 09:18:29 +00:00
Richard Hughes
8b62bf6b64 Set the context in the right place more often 2022-03-16 09:18:29 +00:00
Richard Hughes
945002f7a3 Fix build for MacOS
This is more for curiosity than anything else.
2022-03-15 14:37:28 +00: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