Commit Graph

358 Commits

Author SHA1 Message Date
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
Richard Hughes
1846b36fb2 dfu: Fix a trivial memory leak introduced in the last commit 2022-05-12 11:58:22 +01:00
Richard Hughes
3047ed1517 dfu: Set the DfuDevice as a proxy to the DfuTarget
Set the alt_name_for_display as the target name and use the logical ID
as the target alt-name. This allows us to use the ->to_string() vfunc.
2022-05-12 08:38:18 +01:00
Chen HungNien
5bc1b60bf0 [fwupd:dfu] Update dfu quirk file for SPIT pccam's chips 2022-05-12 08:36:46 +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
beb49d7ac0 trivial: Add fu_common_read_uint24() helper for future code 2022-04-28 14:18:30 +01:00
PatriciaJonsson
0570829981
dfu: Add support for FlatFrog devices 2022-04-25 10:36:27 +01:00
Richard Hughes
a1517e4875 dfu: Use the correct icon automatically for USB webcams 2022-04-23 08:56:58 +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
Jierger Zhou
443b6450f0 dfu: modified VID/PID for atlas camera. 2022-04-13 08:12:09 +01:00
Richard Hughes
d005796af1 dfu: Add unsigned-payload for one of the demo devices 2022-03-28 15:40:30 +01:00
Richard Hughes
8b62bf6b64 Set the context in the right place more often 2022-03-16 09:18:29 +00:00
Richard Hughes
908ccf78ce dfu: Mark various Poly products as signed and unsigned 2022-03-04 23:11:05 +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
Mario Limonciello
661990ed98 Convert build system to use meson tristate features
tristate features will automatically disable if dependencies marked
as required are missing.

Packagers can manually override using `auto_features`.

Link: https://mesonbuild.com/Build-options.html#features
2022-02-28 08:34:48 -06:00
Richard Hughes
b5e7a0be16 Do not use gettext before calling setlocale 2022-02-09 16:56:47 +00:00
Richard Hughes
2b310fb368 dfu: Downgrade a trivial harmless warning to debug 2022-02-08 11:56:20 +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
Mario Limonciello
f57a6637c9 trivial: fix man page sections
They're marked in the man page as section 8 but installed into 1.
They should be installed into 1 as they're not admin tools.
2022-01-04 14:17:43 -06: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
8fc8539146 trivial: Remove some unused variables 2021-12-10 16:00:07 +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
8c94489b4a dfu: Fix unintentional regression when merging the FuProgress work
See https://github.com/fwupd/fwupd/pull/3678/files#r758752086
2021-11-29 21:38:19 +00:00
Richard Hughes
a4a0872727 dfu: Fix a progress warning when attaching AVR32 2021-11-27 07:22:37 +00:00
Richard Hughes
e121332c97 dfu: Do not wait for a USB runtime if will-disappear is set
Fixes https://github.com/fwupd/fwupd/issues/4000
2021-11-24 15:47:53 +00:00
Richard Hughes
d62d281871 dfu: Ignore a USB error for STM32 attach when the device goes away 2021-11-24 15:47:53 +00:00
Richard Hughes
8f0985fb9a dfu: Fix a crash if the attach failed due to hw fault 2021-11-16 17:04:07 +00:00
Richard Hughes
571d22d9b9 dfu: Do not try to handle attach and detach in dump-firmware
This just can't work, as devices typically replug with a different VID and PID.
2021-11-16 17:04:07 +00:00
Richard Hughes
8477d248e6 dfu: Use DfuSe when the target defines an alt name
This fixes dump-firmware on AVR devices that only have one target.
2021-11-16 17:04:07 +00:00
Richard Hughes
51ba3d99bd dfu: Allow the DFU plugin to write Intel HEX firmware
This was being used in the A3BU device test, which broke when we
switched to fu_firmware_new_from_gtypes().
2021-11-16 17:04:07 +00:00
Richard Hughes
f62a2a32d0 dfu: Fix some unconverted FuProgress usage 2021-11-16 17:04:07 +00:00
Richard Hughes
eef106213e dfu: Add some trivial debugging to locate a bug 2021-11-15 16:40:27 +00:00
Richard Hughes
49afe450ab Use -Dcompat_cli=false to reduce the install size by over 100Kb
We don't need these binaries for green-field projects.
2021-11-15 15:01:22 +00:00
Richard Hughes
31d692f1a2 dfu: Fix all devices that rely on use-any-interface
This was a regression caused in aaa77c6f51.
2021-11-15 15:00:07 +00:00
Richard Hughes
da4f50ccf0 dfu: Fix replugging when using dfu-tool to flash hardware
All kinds of things break when using more than one GUsbContext at the
same time.
2021-11-12 15:27:01 +00:00
Richard Hughes
f9cba32625 dfu: Fix critical warning when using dfu-tool
Actually connect to the correct object.

Fixes https://github.com/fwupd/fwupd/issues/3975
2021-11-12 15:27:01 +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
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
Richard Hughes
478e44bc19 trivial: Do not use g_assert() in self test code
Note that g_assert() should not be used in unit tests, since it is a
no-op when compiling with G_DISABLE_ASSERT. Use g_assert() in production
code, and g_assert_true() in unit tests.

See https://github.com/fwupd/fwupd/issues/3790
2021-09-24 22:20:21 +01:00
Richard Hughes
431dbee65a Lower the GUsb dep to allow compiling on RHEL-8
This is something that I keep being asked to do...
2021-09-24 06:50:59 -05:00
Richard Hughes
1ff96eb4b3 Restore the ABI for fu_device_detach() and provide new symbols
Quite a few plugins are using a FuDeviceLocker to detach then attach in
the error path, and finding them isn't easy as we explicitly cast to a
FuDeviceLockerFunc.

For sanity, just provide both symbols so we can do the right thing in
both cases. It seems like a sensible thing to allow.

Fixes https://github.com/fwupd/fwupd/issues/3771
2021-09-17 16:35:21 +01:00
Richard Hughes
40cd18fa97 Allow using a per-device global percentage completion
It's actually quite hard to build a front-end for fwupd at the moment
as you're never sure when the progress bar is going to zip back to 0%
and start all over again. Some plugins go 0..100% for write, others
go 0..100% for erase, then again for write, then *again* for verify.

By creating a helper object we can easily split up the progress of the
specific task, e.g. write_firmware().

We can encode at the plugin level "the erase takes 50% of the time, the
write takes 40% and the read takes 10%". This means we can have a
progressbar which goes up just once at a consistent speed.
2021-09-13 14:28:15 +01:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Richard Hughes
6a8f285ee2 Check the quirk format as part of precommit 2021-08-23 18:10:12 +01:00
Jing-Jie Zhou
8b477ed5e8 modified. DeviceInstanceId is deprecated! 2021-08-23 06:50:28 -05:00
Jierger Zhou
3fbdbd64aa dfu: add quirks for AVer ATLAS CAM/CAM520 Pro2 2021-08-23 06:50:28 -05:00
Jerry Zhang
dfc0254683 dfu: Introduct a quirk to allow zero polltimeout in dfuDNLOAD.
Some Poly usb devices report zero in the bwPollTimeout field of
GET_STATUS request. The host can issue the next DFU_DNLOAD
request immediately without any delay.

Introduced a private flag to skip the default DNLOAD timeout
(5ms) fix. It could remarkably reduce the firmware downloading
time taking into account the large firmware (more than 500MB).
2021-08-16 10:01:27 -05:00
Jerry Zhang
0776918dd8 dfu: Add support for Poly Studio P21 usb device
Specify the Flags in dfu.qurik for Poly Studio P21's camera.
2021-08-04 17:27:11 +01:00
Jerry Zhang
bb5bae8c17 dfu: Add support for more Poly usb devices
Specify the Flags in dfu.qurik for Poly Studio R30, P5 and E70.
2021-07-28 18:46:53 +01:00
Mario Limonciello
798d1ed3ee trivial: update markdown for pre-commit style 2021-07-18 14:42:47 -05:00