Commit Graph

25 Commits

Author SHA1 Message Date
Richard Hughes
2bae97c6c2 vli: Use a plugin prefix for quirk keys 2021-03-03 08:30:34 +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
fb3b3e1841 vli: Read from the device in a more safe way 2021-02-10 16:29:57 +00:00
Richard Hughes
9a241be490 trivial: Add fu_chunk_array_mutable_new()
This allows us to check that the plugin is writing into a mutable buffer. Also
fix up the plugins that are currently 'wrong' and use the new function for the
plugins doing the right thing.
2021-01-29 14:22:20 +00:00
Richard Hughes
d99f86023f trivial: Add getters to FuChunk
At the moment FuChunks are sometimes mutable, and sometimes immutable, and it's
all a bit too low level for comfort.

Before we can do any kind of optimisation or verification we need plugins to
stop reading directly from the C structure. The aim here is to make FuChunk
optionally mutable without making assumptions about the memory model, and also
to be able to introspect it for the docs.
2021-01-28 16:42:54 +00:00
Richard Hughes
5c9b1fcc81 Only include the start year in the copyright header
The end year is legally and functionally redundant, and more importantly causes
cherry-pick conflicts when trying to maintain old branches. Use git for history.
2021-01-07 14:48:16 +00:00
Richard Hughes
58993ac005 trivial: Fix some error prefixes 2020-11-06 09:57:03 +00:00
Richard Hughes
cc2f6aa1b2 Add fu_device_sleep_with_progress helper()
This makes the console a bit more helpful than just 'hanging'...
2020-10-11 07:34:00 +01:00
Richard Hughes
538fa633e8 vli: Remove useless debugging line
We know the flash_id as it's one of the InstanceIDs.
2020-10-01 16:39:10 +01:00
Richard Hughes
b114661a25 Collect per-device report metadata for the history database
Add two new vfuncs that can be used to collect report metadata from devices
both before and after the update has run. This means we can remove the hacks
where we set add 'global' metadata entries and just hope that there is only one
device from the same plugin that is updated.

This also allows us to collect debugging metadata from devices after an offline
update has been run.
2020-06-16 15:49:28 +01:00
Richard Hughes
8a71bd128f vli: Add no-guid-matching for all VLI devices
We need to detect different USB 3.x hubs on the ThinkPad Basic, Pro and Ultra
docking stations.
2020-05-15 16:38:18 +01:00
Richard Hughes
cddf5b5b89 Only auto-add counterpart GUIDs when required
Doing this unconditionally means we accidentally 'bleed' one device mode into
another in a non-obvious way. For instance, a device might have two operating
modes with different GUIDs. If firmware is supplied for both modes in the same
cabinet archive then we might accidentally match the 'wrong' firmware when
the daemon has observed a mode switch and added the counterpart GUIDs.

We only really need the counterpart GUIDs when switching between Jabra, 8bitdo
and DFU devices where the DFU bootloader VID:PID is not manually tagged with
`CounterpartGuid` in a quirk file. In the general case lets keep it simple to
avoid difficult to find bugs.
2020-04-08 13:55:39 +01:00
Richard Hughes
69b761ce64 trivial: Export fu_device_add_instance_id_full() for plugins to use
Sometimes we only want to add the instance ID to get the quirk matches, and it
is confusing to see the "fake" IDs in the 'fwupdmgr get-devices' output.
2020-03-24 14:43:31 +00:00
Richard Hughes
ac48c7f45a trivial: Add a GObject property for FuVliDevice::kind 2020-03-19 06:43:42 +00:00
Richard Hughes
aebd90baad vli: Fix VL103 reboot from ROM mode to FW mode
The logic was wrong; we should have been using command 0xB0 for attach back to
FW mode for both VL10x and VL103. Using a generic reset on VL103 always reset
the device back into bootloader mode as the ROM signatures were being written
by command 0xC0.

As now attach and detach have different code paths, there's no point having a
`FuVliDevice->reset()` vfunc, and so we can make everything a little simpler at
the same time.
2020-03-10 10:46:01 +00:00
Richard Hughes
e4661788ec vli: Set the device progress correctly when erasing a PD device 2020-02-06 20:38:19 +00:00
Richard Hughes
4359ea9017 vli: Set all standalone PD devices to not do SPI auto-detection 2020-02-06 20:38:19 +00:00
Richard Hughes
e01c4cc8cb vli: Add the DEV instance ID to all devices
In some composite dock hardware there are two USB devices exported to the host,
both with the same VID:PID values. We need to use the device type (e.g. VL812B3)
to differenciate the devices and install the correct fw on the correct device.
2020-02-04 15:52:07 +00:00
Richard Hughes
5bf8c1a23b vli: Set more of the firmware max sizes automatically
With data from VIA, many thanks.
2020-01-02 13:24:13 +00:00
Richard Hughes
727938427b vli: Add a SpiAutoDetect quirk for some of the PD devices
It seems command 0xc0 is not supported on this hardware.
2020-01-02 13:24:13 +00:00
Richard Hughes
a24752d661 vli: Add support for standalone Single PD devices 2020-01-02 13:24:13 +00:00
Richard Hughes
52a7d0bd34 vli: Move generic SPI functionality into the FuVliDevice base class
To implement the SPI commands, objects can derive from FuVliDevice and
implement the new vfuncs. This allows us to override the implementation for
minor API changes.
2020-01-02 13:24:13 +00:00
Richard Hughes
e2a9b15f16 vli: Allow setting the device kind from a quirk 2020-01-02 13:24:13 +00:00
Richard Hughes
3243374d41 vli: Move the SPI command quirking from FuVliUsbhubDevice down to FuVliDevice 2020-01-02 13:24:13 +00:00
Richard Hughes
b02d9988ad vli: Add a FuVliDevice as a subclass to FuVliUsbhubDevice
At the moment this doe not do anything clever, but other device types will
derive from the base class in the future.
2020-01-02 13:24:13 +00:00