Commit Graph

20 Commits

Author SHA1 Message Date
Richard Hughes
bf72d393fd Split up FuUsbDevice into ->open() and ->setup()
Before this change calling FuUsbDevice->open() opened the device, and
also unconditionally added various GUIDs and InstanceIDs which we
normally do in setup.
Then fu_device_setup() would call the FuSubclass->setup() vfunc which
would have no way of either opting out of the FuUsbDevice->setup()-like
behaviour, or controlling if the parent class ->setup is run before or
after the subclass setup.

Split up FuUsbDevice->open() into clear ->open() and ->setup() phases
and add the parent class calls where appropriate.

This means that ->setup() now behaves the same as all the other vfuncs.
2021-06-17 16:21:41 +01:00
Richard Hughes
832231da9c synaptics-prometheus: Fix enumeration of the config child
Do not manually call config setup before adding the parent.

The ->setup() action is called on children explicitly in fu_device_setup()
after the parent device has all the required properties.

Fixes https://github.com/fwupd/fwupd/issues/3364
2021-06-15 11:46:17 -05:00
Mario Limonciello
1f9c035788 trivial: fix some trailing whitespace problems across the project 2021-04-09 16:02:20 +01: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
2e1245728f Call the superclass directly from subclassed devices
This allows a device subclass to call the parent method after doing an initial
action, or even deliberately not call the *generic* parent method at all.

It also simplifies the plugins; you no longer have to remember what the plugin
is deriving from and accidentally clobber the wrong superclass method.
2021-02-18 16:18:34 +00:00
Richard Hughes
cf100293b5 Do not export useless device attributes to the client
That giant uint64_t isn't looking so big now, and we'll want to add even more
to it in the future. Split out some private flags that are never useful to the
client, although the #defines will have to remain until we break API again.
2021-01-06 14:36:23 +00:00
Richard Hughes
3252573ac7 synaptics-prometheus: Fix flashing a fingerprint reader that is in use
The fprint daemon only keeps the device open for 5 seconds and then releases it,
which seems like a small window to hit.

But! We're asking the user to authenticate with the same device we're about to
upgrade so a different part of the stack woke up the hardware just before we're
about to deploy an update onto it.

Just retry a few times to make sure the device is idle. Use a flag to prevent
accidentally causing regressions in other plugins.

Fixes https://github.com/fwupd/fwupd/issues/2650
2021-01-04 21:52:10 +00:00
Richard Hughes
6450d0deb4 Add FwupdInstallFlags of _IGNORE_CHECKSUM, _IGNORE_VID_PID and _IGNORE_POWER
The FWUPD_INSTALL_FLAG_FORCE flag has really unclear semantics, and ignoring a
file CRC, checksum or model ID should only be done when using fwupdtool actually
debugging a plugin or firmware parser.

Use the existing --force flag when we want a "gentle nudge" like reuploading
previously processed reports.
2020-10-07 13:15:09 +01:00
Richard Hughes
9b688d0b73 trivial: Set FWUPD_STATUS_DECOMPRESSING when preparing firmware
This avoids the plugins forgetting to do it themselves.
2020-09-08 14:18:46 +01:00
Vincent Huang
0a11350396 synaptics-prometheus: Force the minor version from 0x02 to 0x01 to make
sure the devices can be updated back to 0x01.
2020-05-19 15:12:10 +01:00
Richard Hughes
a8c6c02459 Do not conditionalize attach() and detach() on IS_BOOTLOADER
This is nice in theory, until you need to look at the bootloader status of the
parent, or of a different device entirely. Handle this in plugins for the few
cases we care about and stop setting or clearing IS_BOOTLOADER manually just to
get the vfuncs to be run.

Note: I do not think we want to use cleanup() for attaching devices not in
bootloader states -- as cleanup is only run at the end of the composite update.
2020-04-09 09:55:30 +01:00
Richard Hughes
f50ff2c27e Decouple the version format from the version itself
If we say that the version format should be the same for the `version_lowest`
and the `version_bootloader` then it does not always make sense to set it at
the same time.

Moving the `version_format` to a standalone first-class property also means it
can be typically be set in the custom device `_init()` function, which means we
don't need to worry about *changing* ther version format as set by the USB and
UDev superclass helpers.
2020-02-25 14:00:09 +00:00
Vincent Huang
3e3a0277c9 synaptics-prometheus: Allow incremental version major and minor number 2019-12-03 11:06:52 +00:00
Richard Hughes
6d80b84b95 synaptics-prometheus: Reload the device version after update 2019-11-29 12:03:04 +00:00
Richard Hughes
ed3f6cfd4f synaptics-prometheus: Manually set the bootloader mode when attaching
The fingerprint reader device doesn't actually disconnect and reconnect and
so the FuDevice->setup() vfunc never gets called.
2019-11-26 14:15:11 +00:00
Richard Hughes
56ac823af9 Set the protocol per-device not per-plugin
Some plugins have devices with more than one protocol. Logically the protocol
belongs to the device, not the plugin, and in the future we could use this to
further check firmware that's about to be deployed.

This is also not exported into libfwupd (yet?) as it's remains a debug-feature
only -- protocols are not actually required for devices to be added.
2019-11-25 18:01:54 +00:00
Richard Hughes
480b386512 synaptics-prometheus: Don't add a config-subdevice in bootloader mode
We can't use the IOTA mechanism in bootloader mode, and failing to create the
FuSynapromDevice object means we can't recover the hardware if the flash failed.
2019-10-30 06:44:14 -05:00
Mario Limonciello
8fa0b382fa Add new flags can-verify and can-verify-image
These are used to indicate that the device can verify checksums or
can dump an image for checksumming.
2019-10-14 12:41:09 -05:00
Richard Hughes
7afd7cba0d Use FuFirmware as a container for firmware images
In many plugins we've wanted to use ->prepare_firmware() to parse the firmware
ahead of ->detach() and ->write_firmware() but this has the limitation that it
can only return a single blob of data.

For many devices, multiple binary blobs are required from one parsed image,
for instance providing signatures, config and data blobs that have to be pushed
to the device in different way.

This also means we parse the firmware *before* we ask the user to detach.

Break the internal FuDevice API to support these firmware types as they become
more popular.

This also allows us to move the Intel HEX and SREC parsing out of the dfu plugin
as they are used by a few plugins now, and resolving symbols between plugins
isn't exactly awesome.
2019-08-08 13:10:57 +01:00
Richard Hughes
c7bdded2c6 Add a plugin to update Synaptics Prometheus fingerprint readers 2019-05-14 17:18:55 +01:00