Commit Graph

136 Commits

Author SHA1 Message Date
Richard Hughes
15bf534e3f Set the verfmt of the returned device when the daemon device is unset
This regressed in 1.5.5 when we migrated FWUPD_DEVICE_FLAG_MD_SET_VERFMT
into FU_DEVICE_INTERNAL_FLAG_MD_SET_VERFMT and forgot to copy the system
device internal flags.
2021-10-18 06:57:09 +01:00
Richard Hughes
dbf92be359 trivial: Add fu_device_add_string() for future use 2021-10-14 15:49:58 +01:00
Gaël PORTAY
918006f8d5 trivial: Codespell fixes 2021-10-14 09:09:54 -05:00
Richard Hughes
c22c2e0752 trivial: Prevent a possible warning when using _FLAG_INHIBIT_CHILDREN 2021-10-07 17:42:39 +01:00
Richard Hughes
39d8baf516 trivial: Notify when the FuDevice:parent is set
This allows us to perform a callback when the parent instance is set or
changed.
2021-10-05 18:15:53 +01:00
Richard Hughes
1ff96eb4b3 Restore the ABI for fu_device_detach() and provide new symbols
Quite a few plugins are using a FuDeviceLocker to detach then attach in
the error path, and finding them isn't easy as we explicitly cast to a
FuDeviceLockerFunc.

For sanity, just provide both symbols so we can do the right thing in
both cases. It seems like a sensible thing to allow.

Fixes https://github.com/fwupd/fwupd/issues/3771
2021-09-17 16:35:21 +01:00
Richard Hughes
320f8d7d90 Update the child composite ID if the parent changes
Typically, this can be triggered with:

 * create parent
 * set parent physical ID
 * add new child to parent
 * set parent logical ID
2021-09-16 07:44:44 +01: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
Richard Hughes
b3824c94fa Fix a regression in flashing the Dell dock
This fixes a regression caused by 15b668c, we should have been more careful.

Fixes https://github.com/fwupd/fwupd/issues/3732
2021-09-10 15:50:52 +01:00
Richard Hughes
8b47bbeb09 trivial: Allow setting the FuDevice context in a constructor
This allows devices to add instance IDs in object_class->constructed,
e.g. FuWacModule.
2021-09-08 15:49:19 +01:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Richard Hughes
486f793df7 Recalculate the device inhibits when the flags property changes
Fixes https://github.com/fwupd/fwupd/issues/3622
2021-08-11 10:54:38 +01:00
Richard Hughes
f42b44e427 Remove some deprecated API 2021-08-06 19:49:53 +01:00
Richard Hughes
12842fdfce Fall back to the parent if the child does not have a battery level set 2021-08-04 09:29:02 +01:00
Richard Hughes
05c1f2b1f3 trivial: Fix docgen warning that crept in with FwupdRequest 2021-08-03 17:33:21 +01:00
Richard Hughes
8f19ea75d3 Sanitize the device name harder 2021-08-03 15:45:37 +01:00
Richard Hughes
3b919fc38d trivial: Actually use USE_PARENT_FOR_OPEN for close as the docs say
This fixes updating the Synaptics prometheus hardware.
2021-07-30 18:53:30 +01:00
Richard Hughes
d8f9b66e0e trivial: Actually use the right USE_PARENT_FOR_OPEN flag 2021-07-30 18:53:30 +01:00
Richard Hughes
0efa97229a Automatically clear the update error as required
This is less fragile than patching all the callers.
2021-07-23 13:16:47 +01:00
Richard Hughes
55f6fd435a Add a ->get_results() vfunc that can be used by subclasses of FuDevice 2021-07-22 12:47:54 +01:00
Richard Hughes
15b668c0c6 Open the device proxy in the engine where required
The benefit of using the proxy device is that we can 'use' the proxy
device for device access, but 'report' the progress on the passed
FuDevice instance.

This means the front-end reports the device status correctly when
updating composite devices that us proxies.

The comment always said we should move it to the daemon if another
plugin started doing this, and that is now.
2021-07-17 17:20:01 +01:00
Richard Hughes
a65f5759ef trivial: Fix a typo of fwupd itself 2021-07-15 09:33:25 +01:00
Richard Hughes
19abf996c7 Allow the daemon to request interactive action from the end user
The "return error and hope the client resubmits the firmware again"
pattern is clunky. There are two plugins doing this now, and about to
be one more.

This adds FwupdRequest which provides a structured way of asking the
user to perform an action, e.g. to replug the device or to press a
special key or button.

This replaces much of the UpdateMessage and UpdateImage API although
it is still used internally. Clients capable of processing the new
DeviceRequest signal should add REQUESTS to their feature flags.

Also, this allows us go back to the old meaning of _NEEDS_BOOTLOADER,
which was "needs rebooting into a bootloader mode" rather than the
slightly weird "user needs to do something and resubmit request".
2021-07-14 17:03:50 +01:00
Richard Hughes
b2ee236060 trivial: Show a critical warning if a device has no context 2021-07-12 19:01:55 +01:00
Richard Hughes
d938ab62e6 trivial: Add fu_device_add_guid_full() to control behaviour 2021-07-12 19:01:55 +01:00
Richard Hughes
53538685fc trivial: Add FU_DEVICE_INSTANCE_FLAG_NO_QUIRKS to avoid quirk matches 2021-07-12 19:01:55 +01:00
Richard Hughes
9c31d1fadd trivial: Set the FuContext on more devices 2021-07-12 19:01:55 +01:00
Richard Hughes
0cc06f032c Add a flag to open and close with the parent device
This is a common pattern that is used in lots of plugins, so move the
logic into common code.
2021-07-11 16:37:47 +01:00
Richard Hughes
a84b76573a trivial: Set the remove delay on the child automatically 2021-07-10 07:37:59 +01:00
Richard Hughes
3b84bb2135 trivial: Set the backend ID on children if unset
This allows children of devices that derive from FuUdevDevice to be
removed correctly.
2021-07-10 07:37:59 +01:00
Richard Hughes
f89cb3850b Add a device flag to control child removal
At the moment the device list auto-removes children when the parent is
removed. This was originally working around the bug that the child
devices had no backend ID, and thus were not matched like the parent
in fu_engine_backend_device_removed_cb() and removed automatically.

Using the workaround means that the children are potentially removed
before the parent depending on the order of the device list -- which
might be modified by replug events.

I think the old cleanup is probably an anti-pattern, and going forward
composite devices should probably define _NO_AUTO_REMOVE_CHILDREN but
we don't want to change this behaviour for plugins already expecting
the old flow, or for devices with no parent backend IDs.
2021-07-09 19:46:41 +01:00
Richard Hughes
a117b7da12 trivial: Correctly show negative device order numbers 2021-07-09 17:01:45 +01:00
Richard Hughes
5458480356 Add a flag which inhibits children automatically
Fixes https://github.com/fwupd/fwupd/issues/3454
2021-07-07 12:50:27 +01:00
Richard Hughes
7b209bb2c1 Watch for children added or removed after setup has been completed
Some devices may 'discover' child devices during poll, rather than the
more usual case of adding them as children during setup.
2021-07-02 13:27:10 +01:00
Richard Hughes
1cee26eba9 Remove the vendor string from the device name where required
This means we don't display something like 'Logitech Logitech Product'
when showing the devices on one line.

This is now required in two plugins so move it to common code. Also
support setting the properties in either order to prevent regressions
when using the device name as part of the instance ID.
2021-06-30 18:43:07 +01: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
Richard Hughes
fe7b0794b3 Use the parent physical ID to autoset the device parent
Of course, this only works if the parent and child both export a
FuDevice of the same physical kind, e.g. USB.
2021-06-19 16:57:35 +01:00
Richard Hughes
a2682eeed9 Add a device flag to ignore the serial number
On some devices the serial number is junk, or not set. On some Wacom
hardware reading the serial LangID puts the device into Android mode...
2021-06-18 14:03:54 +01:00
Richard Hughes
2db68bf835 trivial: Fix setting internal flags from quirk files
This is a typo, non-negated flags shouldn't be removed.
2021-06-17 17:47:06 +01:00
Richard Hughes
9f13d8ed1e vli: Be more specific when matching the MSP430
Add a FuDevice->ready() vfunc that is run after ->setup()
This allows plugins to perform setup actions that require quirk matches
after the instance IDs have been converted. This allows us to also
remove FuVliDevice->setup() as the ordering chain has been broken.

There are two USB-3 hubs internally (with the same VID&PID), and the
MSP430 is only attached to the top-level one.

Fixes https://github.com/fwupd/fwupd/issues/3366
2021-06-17 17:09:48 +01:00
Mario Limonciello
800d45549c trivial: fix a codespell mistake 2021-06-16 06:41:46 -05:00
Richard Hughes
bda57e8c9d modem-manager: Do not convert instance IDs to GUIDs manually
This already happens during setup, there shouldn't be a need to depend
on the private header to accomplish this.
2021-06-15 09:14:39 -05:00
Richard Hughes
e64ebe8a7c trivial: Allow setting device inhibits from quirk files 2021-06-15 14:15:34 +01:00
Richard Hughes
a5a82ba519 trivial: Fix the FuDeviceInternalFlags conversion funcs 2021-06-15 10:18:24 +01:00
Richard Hughes
a02c1073f2 trivial: Fix up some of the developer docs
And add some missing content as requried.
2021-06-11 09:39:03 +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
d1717f19cd Ensure the composite ID is used when setting parent during construction
Shadow FwupdDevice::parent with FuDevice::parent so that we *also* set
the context and composite ID.
This means we can always install all components of the Lenovo docks.
2021-06-08 15:29:43 +01:00
Richard Hughes
54d9de9290 Force the device locker to ->close() an aborted ->open()
Fixes https://github.com/fwupd/fwupd/issues/3187
2021-05-12 10:10:57 +01:00
Richard Hughes
20ef071b3c trivial: Style fixes to lots of gtk-doc 2021-05-10 14:35:10 +01:00