Commit Graph

35 Commits

Author SHA1 Message Date
Mario Limonciello
a42daefb9e dell-dock: Capture the dock SKU in metadata
Should be helpful in reproducing failure reports.
2020-05-26 10:22:58 -05:00
Mario Limonciello
768a2680a6 Introduce a new flag skips-restart
This flag is used internally by plugins to indicate that they will
skip the phase of firmware installation that power cycles a device.

It is intended to be set by quirks or other environment settings.
2020-05-06 15:13:40 -05:00
Richard Hughes
a1ef52e5f9 dell-dock: Port to using fu_device_get_proxy()
This also cleans up the memory handling to prevent a ref-cycle loop that
prevented the dock devices from being finalized if the dock was removed.
2020-04-15 20:34:31 +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
Richard Hughes
9a68084dbc Always check for PLAIN when doing vercmp() operations
In 1de7cc we checked the version format when checking for update, but there are
many other places that are doing verfmt-insensitive comparisons. For instance,
the predicates in <requires> all fail if the device version format is plain.
his breaks updating some NVMe drives where the `ne` requirements are not
semantic versions.

To avoid trying to catch all the bugs in different places, and in case we have
a future verfmt that should be treated another way, refactor this out in to a
common function and deprecate the old function.
2020-02-20 15:49:27 +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
4b30380e78 Provide a default implementation of common FuDevice actions
This reduces the amount of boilerplate in each plugin.

    32 files changed, 156 insertions(+), 584 deletions(-)
2019-10-04 14:57:32 +01:00
Mario Limonciello
e13f7a142e trivial: dell-dock: correct an error preventing write_size from being set
This fixes 7afd7cba0d which led to write_size
being set to 0 and an endless loop.
2019-08-27 09:28:30 -05:00
Richard Hughes
6e3e62bee8 Use fu_common_string_append_kv() in subclassed device
Also define the indent level in the the ->to_string vfunc so we can correctly
print client devices in all cases.
2019-08-14 16:48:37 +01: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
dfa9e11bb2 Allow handling FORCE for devices that subclass FuDevice
Pass FwupdInstallFlags down to the vfunc to allow us to check the flags when
parsing the firmware and updating the device.
2019-05-05 15:29:00 -05:00
Richard Hughes
5079f26f0e Never guess the version format from the version string
This leads to madness, as some formats are supersets of the detected types,
e.g. 'intel-me' is detected as 'quad' and 'bcd' is detected as 'pair'.

Where the version format is defined in a specification or hardcoded in the
source use a hardcoded enum value, otherwise use a quirk override.

Additionally, warn if the version does not match the defined version format
2019-04-30 09:25:41 +01:00
Mario Limonciello
398afe545f trivial: dell-dock: set minimum board to 6
Drop all TODO and quirks for older pre-production boards.
2019-04-23 13:36:30 -05:00
Mario Limonciello
75784c5644 dell-dock: Use activation when calling fwupdtool activate
This will finish passive flow without unplugging the cable.
This feature requires EC27 or later.
2019-02-27 09:04:54 +00:00
Mario Limonciello
e59bee1f45 trivial: dell-dock: make passive dependency include Hub2 1.42
An extra race condition bug exists due to the MCU firmware on Hub2.
Require to already be on 1.42 or later to use passive flow.
2019-02-18 08:03:49 -06:00
Mario Limonciello
9a83af0262 dell-dock: Filter the last supported payloads of certain board 4 SKUs
EC23 is the last version that will be supported on board 4 SKUs with
base PD firmware versions 18+.

* If on EC23 already, don't mark the device as updatable anymore.

* Flashing EC24 or later when currently on EC 22 or less will potentially
  cause bricked docks that can't enumerate, so prevent this scenario
  during update path.
2019-02-13 06:44:25 +00:00
Mario Limonciello
2e9a4242c5 trivial: dell-dock: bump passive requirement to EC25+
Turns out we can't have nice things that work properly just yet.
2019-02-08 06:31:21 +00:00
Richard Hughes
65c81921b6 Add fu_device_add_instance_id() and prefer explicit conversion 2019-02-04 15:19:57 +00:00
Mario Limonciello
ead0deaa25 trivial: dell-dock: enable passive flow on all EC23+
The feature did land in EC23 and testing looks positive.
2019-01-31 10:53:54 -06:00
Mario Limonciello
5502cd5689 dell-dock: Add support for a passive flow
This behavior will prevent the dock from performing most resets until
it has been unplugged from a host system.

This significantly speeds up the perceived update duaration and prevents
data loss during update.

It's not confirmed whether EC23 or later EC will enable it.
* So only enable by a custom flag until this is confirmed.
* Custom flag will be dropped when included into stable EC release.

This functionality also relies upon the CAB file providing a message warning
user that the dock might not be usable after unplugging for up to 1 minute.
2019-01-29 15:51:12 -06:00
Mario Limonciello
654b583031 trivial: dell-dock: Correct a left shift error in BIT_CLEAR macro 2019-01-24 10:35:53 -06:00
Mario Limonciello
d6e453b0ba dell-dock: Add support for flashing Thunderbolt over I2C
This uses an API in the Realtek USB 3.1G2 controller to perform
the flash procedure.
2019-01-24 16:23:00 +00:00
Mario Limonciello
18f3ab4e4d trivial: dell-dock: Prohibit downgrades on board 4 or later below EC19
Some SKUs of board 4 and later have silicon that will not work with anything
but EC19 or later.  So once flashed up to EC19 prohibit downgrades below that
to keep from bricking devices.
2019-01-15 08:52:12 +00:00
Mario Limonciello
84e948a5b0 trivial: dell-dock: correct an assertion related to setting EC version
This is probably fall out from a previous code re-shuffling.
The EC version is already set elsewhere, and in many cases `self->ec_version`
is `NULL` at this time.
2019-01-10 13:44:48 -06:00
Mario Limonciello
8963d6b4b2 dell-dock: Set minimum board to board 4
This allows dropping all the quirks related to older boards.
2019-01-08 12:36:36 -06:00
Mario Limonciello
993fc1636c dell-dock: Workaround a manufacturing bug for board level 4
Board 4 was manufactured with package version 89.16.01.00 and this
will prevent properly upgrading between releases.  Reset this version
to 00.00.00.00 if detected on this board.
2019-01-08 12:36:36 -06:00
Mario Limonciello
b4e3698cfb dell-dock: Wait longer for re-enumeration on TBT SKU
Emperically this seems to take 7-10 seconds longer on this SKU.
2019-01-08 12:36:36 -06:00
Mario Limonciello
817a15a1bf trivial: dell-dock: Set EC version to daemon before EC reset
If the process fails (or was skipped due to 'skip-restart') this will
prevent the daemon from trying again until the dock has been power
cycled.
2018-11-27 11:05:26 +00:00
Mario Limonciello
1210332e05 trivial: dell-dock: fail when EC indicates flashing an invalid/unsigned image
Otherwise this would cause fwupd to sit in an endless loop when providing a bad
image.

This additional enum is only available in EC16, but since it doesn't break existing
API on older EC images, don't bump minimum requirement to EC16 yet.
2018-11-27 11:05:26 +00:00
Richard Hughes
ac458d3436 Guess the version format when it is not provided
The most important change here is that versions without dots (not a 'semver')
are treated as 'PLAIN' rather than 'UNKNOWN'.
2018-11-14 11:52:46 +00:00
Richard Hughes
481aa2a923 Port from libappstream-glib to libxmlb
The libxmlb library is much faster to query, and does not require the daemon
to parse the XML metadata at startup. It's a zero-copy mmap design that is more
modern and less clunky.

RSS has reduced from 3Mb (peak 3.61Mb) to 1Mb (peak 1.07Mb) and the startup
time has gone from 280ms to 250ms.
2018-10-17 14:41:13 +01:00
Mario Limonciello
860e99357b dell-dock: If marketing name is invalid don't fail initialization
These are certainly bugs with one of the components, but if the situation
happens in the field the plugin needs to finish initialization to allow
upgrading to a fixed component.

We'll just fall back to the name in the quirk (Dell dock) in this case.
2018-10-14 17:23:38 -05:00
Richard Hughes
c012c81540 dell-dock: Use different debug strings for each device type 2018-10-12 10:34:09 +01:00
Richard Hughes
5e84da6bfe dell-dock: Don't use the VLA feature in the new dock
This is a massive co-incidence.
2018-10-12 08:08:33 +01:00
Mario Limonciello
558055c9b7 Add a plugin for an upcoming Dell USB-C dock
This plugin requires infrastructure introduced in fwupd 1.1.3
and can not be backported to earlier versions of fwupd.

It works together with the Synaptics and Thunderbolt plugins to
coordinate the proper flashing procedure for devices in this dock.
2018-10-12 07:58:29 +01:00