Commit Graph

44 Commits

Author SHA1 Message Date
Richard Hughes
faa7871b08 Remove duplicate ->probe() calls to speed up startup by 150ms
Now incorporate is fixed to copy across the properties we need in the
superclass, we don't need to do the subclass ->probe().

Note, we still need to do the subclassed ->probe() when using
FU_UDEV_DEVICE_FLAG_VENDOR_FROM_PARENT or when looking at properties
on the parent device.

This also removes the spurious 'already set GType to FuVliUsbhubDevice,
ignoring FuVliUsbhubDevice' messages when running the daemon.
2022-06-14 21:01:57 +01:00
Richard Hughes
fc2da47b69 Remove fu_strtoull_full() 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
ed1b13da28 Split out the memory 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
dc91d59f8e Remove the recently added fu_progress_add_step_full()
Just break API instead.
2022-06-03 13:47:11 -05: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
Richard Hughes
beb49d7ac0 trivial: Add fu_common_read_uint24() helper for future code 2022-04-28 14:18:30 +01:00
Richard Hughes
a1517e4875 dfu: Use the correct icon automatically for USB webcams 2022-04-23 08:56:58 +01:00
Richard Hughes
8b62bf6b64 Set the context in the right place more often 2022-03-16 09:18:29 +00:00
Richard Hughes
2b310fb368 dfu: Downgrade a trivial harmless warning to debug 2022-02-08 11:56:20 +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
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
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
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
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
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
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
Richard Hughes
aaa77c6f51 Allow adding and removing custom flags on devices
The CustomFlags feature is a bit of a hack where we just join the flags
and store in the device metadata section as a string. This makes it
inefficient to check if just one flag exists as we have to split the
string to a temporary array each time.

Rather than adding to the hack by splitting, appending (if not exists)
then joining again, store the flags in the plugin privdata directly.

This allows us to support negating custom properties (e.g. ~hint) and
also allows quirks to append custom values without duplicating them on
each GUID match, e.g.

[USB\VID_17EF&PID_307F]
Plugin = customflag1
[USB\VID_17EF&PID_307F&HUB_0002]
Flags = customflag2

...would result in customflag1,customflag2 which is the same as you'd
get from an enumerated device flag doing the same thing.
2021-06-23 07:59:15 +01:00
Richard Hughes
2360aa296a Use an internal device flag rather that using a custom flag
If this is shared between plugins it needs to be specified in a shared
place.
2021-06-21 19:38:00 +01:00
Mario Limonciello
1e06c12e99 trivial: ci: Check for inclusion of private headers during pre-commit
This will improve the pre-commit hook coverage.

For dfu: waive pre-commit checks for internal header file
This is internal to the plugin not to the library.
2021-06-16 08:32:29 -05:00
Richard Hughes
2dd6462c0c trivial: Export the DFU version constants into libfwupdplugin 2021-06-14 07:15:42 -05:00
Mario Limonciello
73cdf067ed trivial: fixup includes for a variety of plugins 2021-06-14 10:12:45 +01:00
Mario Limonciello
1e17457b16 Allow building the documentation with gi-docgen and gtk-doc
Until gi-docgen is declared stable support either of them.
This effectively means that hand builds and CI builds will use
gi-docgen, but distro builds use gtk-doc-tools.
2021-06-09 22:21:53 +01:00
Richard Hughes
20ef071b3c trivial: Style fixes to lots of gtk-doc 2021-05-10 14:35:10 +01:00
Richard Hughes
89d45a0d91 trivial: Standardize on introspection for @error and @cancellable
Also standarize on `Returns:` for the result.
2021-04-28 16:19:50 +01:00
Richard Hughes
5ad6fb2a27 dfu: Do not show an invalid warning on attach
For some hardware, it is quite expected the device just resets.
2021-04-26 19:38:13 +01:00
Richard Hughes
0a37abfce8 dfu: Do not require wildcard-pid when flashing a raw binary file 2021-04-26 19:38:13 +01:00
Richard Hughes
584f1d4c6a dfu: Fall back to binary files when flashing stm32 hardware 2021-04-26 19:38:13 +01:00
Richard Hughes
4fe318bd54 dfu: Fix up some overzealous replacement when renaming the DFU files 2021-04-23 13:59:44 -05:00
Richard Hughes
1981c63d58 Remove FuFirmwareImage and just use FuFirmware instead
This allows us to 'nest' firmware formats, and removes a ton of duplication.

The aim here is to deprecate FuFirmwareImage -- it's almost always acting
as a 'child' FuFirmware instance, and even copies most of the vfuncs to allow
custom types. If I'm struggling to work out what should be a FuFirmware and
what should be a FuFirmwareImage then a plugin author has no hope.

For simple payloads we were adding bytes into an image and then the image into
a firmware. This gets really messy when most plugins are treating the FuFirmware
*as* the binary firmware file.

The GBytes saved in the FuFirmware would be considered the payload with the
aim of not using FuFirmwareImage in the single-image case.
2021-03-09 21:14:12 +00:00
Richard Hughes
54c683c009 dfu: Use DeviceInstanceIDs to merge AVR quirk metadata
This means we can use the standard ->set_quirk_kv() vfunc rather than using
FuQuirks directly with a custom group.
2021-03-03 08:30:34 +00:00
Richard Hughes
f32e4c0666 dfu: Do not use a heuristic to set the device status
This breaks on all STM32 devices and should be unnecessary now.
2021-03-01 17:04:34 +00:00
Richard Hughes
b3f9841924 Support more than one protocol for a given device
Devices may want to support more than one protocol, and for some devices
(e.g. Unifying peripherals stuck in bootloader mode) you might not even be able
to query for the correct protocol anyway.
2021-03-01 16:14:36 +00:00
Richard Hughes
416562f9af dfu: Do not show a critical error when flashing footer-less binary files 2021-02-26 18:46:28 +00:00
Richard Hughes
d271cebee5 trivial: Fix compile warning with newer libgusb versions 2021-02-26 16:44:31 +00:00
Richard Hughes
078beafb2d Add a new internal flag to opt-in to GUID matching
It is far too easy to forget to set FWUPD_DEVICE_FLAG_NO_GUID_MATCHING for new
plugins, and without it it all works really well *until* a user has two devices
of the same type installed at the same time and then one 'disappears' for hard
to explain reasons. Typically we only need it for replug anyway!

Explicitly opt-in to this rarely-required behaviour, with the default to just
use the physical and logical IDs. Also document the update behavior for each
plugin to explain why the flag is being used.

This allows you to have two identical Unifying plugged in without one of them
being hidden from the user, at the same time allowing a HIDRAW<->USB transition
when going to and from bootloader and runtime modes.

This removes the workaround added in 99eb3f06b6.

Fixes https://github.com/fwupd/fwupd/issues/2915
2021-02-25 15:47:25 +00:00
Richard Hughes
8aebd44404 dfu: Modernize the coding style to match the other plugings
Use a Fu prefix for source objects and files and use @self.

No logic changes.
2021-02-24 10:36:45 +00:00