Commit Graph

9 Commits

Author SHA1 Message Date
Richard Hughes
fbcebe096b Connect the progress and status callbacks on the new FuDevice on replug
This ensures we get progress events when replugging a device. Also, remove the
callbacks on the 'old' device to avoid causing multiple events on a 2nd-replug.
2017-12-11 16:48:56 +00:00
Richard Hughes
7de50dbe92 trivial: Only reuse the added device if it has recently been removed 2017-12-11 09:44:36 +00:00
Richard Hughes
858269ebed trivial: Copy over any missing GUIDs when changing the plugin for a FuDevice 2017-11-24 14:42:27 +00:00
Richard Hughes
381b26c2db trivial: Inherit the version when changing the plugin for a FuDevice
Some plugins like DFU might not be able to get the current version number.
2017-11-24 14:42:27 +00:00
Richard Hughes
a0705aa712 trivial: Inherit the vendor ID when changing the plugin for a FuDevice 2017-11-24 14:42:27 +00:00
Richard Hughes
70425fe923 Allow different plugins to claim the same device
When changing from runtime->bootloader->runtime the usual way of handling this
in a fwupd plugin is to:

* reset the device and wait for a replug
* flash the hardware
* reset the device and wait for a replug

This works well when the runtime and bootloader modes are handled by the same
plugin. For situations like the Nitrokey device, where one plugin handles the
runtime (nitrokey), and another handles the bootloader (dfu) we have to have
the ability to 'ignore' the device removal and just issue a 'changed' signal
so the client refreshes the properties.
2017-11-24 14:42:27 +00:00
Richard Hughes
2dadd09cb1 Optionally delay the device removal
In the case where we can trigger the replug automatically we can have to wait
for a USB re-enumeration (typically a few hundred ms) but when the user is
requred to unplug, and then replug we have to wait a bit longer.

The 'remove delay' allows us to modify per-device the removal delay. In the
case the device does not show back up in the correct time the device will be
auto-removed and the session will get a DeviceRemoved signal. In the case where
the device in bootloader mode shows up within the timeout the session just gets
a DeviceChanged event.

For the duration of the delayed removal the flags for the device are set to
zero to ensure the session does not try to interact with the device whilst
re-enumerating.
2017-11-24 14:42:27 +00:00
Richard Hughes
170c0c13c3 trivial: Route the ::added and ::removed through the FuDeviceList
This will allow the list to withhold events in the future, no functional changes now.
2017-11-24 14:42:27 +00:00
Richard Hughes
0a7e783cdd trivial: Move the device list to a new object
This moves more functionality out of the engine, and will allow us to add some
cleverness to the device list to allow the FuDevice to be shared between
different plugins.
2017-11-24 14:42:27 +00:00