Commit Graph

31 Commits

Author SHA1 Message Date
Richard Hughes
faa7871b08 Remove duplicate ->probe() calls to speed up startup by 150ms
Now incorporate is fixed to copy across the properties we need in the
superclass, we don't need to do the subclass ->probe().

Note, we still need to do the subclassed ->probe() when using
FU_UDEV_DEVICE_FLAG_VENDOR_FROM_PARENT or when looking at properties
on the parent device.

This also removes the spurious 'already set GType to FuVliUsbhubDevice,
ignoring FuVliUsbhubDevice' messages when running the daemon.
2022-06-14 21:01:57 +01:00
Richard Hughes
fc2da47b69 Remove fu_strtoull_full() 2022-06-14 14:36:52 -05:00
Richard Hughes
067d7d8088 Split out the path helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
4b1313b406 Split out the GByte helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
9d33c29e92 Split out the string helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
dc91d59f8e Remove the recently added fu_progress_add_step_full()
Just break API instead.
2022-06-03 13:47:11 -05:00
Richard Hughes
9f584a234a flashrom: Allow dumping firmware using fwupdtool 2022-05-04 14:10:18 +01:00
Sergii Dmytruk
e9f765dc47 plugins/flashrom/fu-flashrom-device.c: create layout on open
This avoids possible reading IFD multiple times and fixes a memory leak
of layout on errors and an unconditional leak in
fu_flashrom_device_prepare(), which didn't call
flashrom_layout_release().

Notice that flashrom_layout_set() call does NOT transfer ownership.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-21 15:39:47 +01:00
Sergii Dmytruk
e1d708a4ff plugins/flashrom: manage flashrom context at plugin level
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-21 15:39:47 +01:00
Sergii Dmytruk
ddf4e10d7b plugins/flashrom: enable for 2 Tuxedo laptops
Their ME region in flash can be unlocked manually, give user
instructions on how to do it.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-21 15:39:47 +01:00
Sergii Dmytruk
523ed0d7b4 plugins/flashrom: make region we're flashing a property
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-19 10:47:41 +01:00
Richard Hughes
2d5186622c Add FuProgress to ->prepare and ->cleanup
Some plugins were creating local versions (which were not attached to
the daemon progress in any way) as a workaround as they needed to do
actions that took a long time to complete.
2022-04-15 16:50:06 +01:00
Richard Hughes
18301f92cf flashrom: Fix a harmless warning when adding an instance ID 2022-04-05 11:38:30 +01:00
Richard Hughes
3390d7f9a5 flashrom: Allow quirking the flashrom flash size
We were using an 'undocumented' local copy of the flash size, when
FuDevice was setting the [ignored] standard device property.
2022-04-05 11:38:30 +01:00
Sean Rhodes
d8b6f5f0b3
plugin/flashrom: Change the default format from triplet to pair (#4395)
Flashrom is primarily used with coreboot, which has a pair version number
currently 4.16. As such, chance the default to pair so that fewer quirks
are required.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-03-17 07:58:25 +00:00
Richard Hughes
6fdae41ae0 flashrom: Simplify the plugin to remove the indirection
For a while we flirted with the idea of updating non-internal
libflashrom-derived devices but the impedance mismatch was just too
great.

We removed the extra unused subclasses of FuFlashromDevice, but never
removed the indirection we added for the writing.
Remove the unused code now that we agree on the longer term plan.
2022-03-09 08:13:13 +00:00
Richard Hughes
f3a13f89dd Allow specifing the DeviceIntegrity flag from metadata 2022-02-22 19:12:06 +00:00
Richard Hughes
58d36dcbe5 Check the value range when parsing the quirk keys
At the moment there isn't an error if you enter something like

    CfiDeviceCmdReadId = 0×12
2021-12-09 13:09:43 +00: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
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Richard Hughes
a87440947d flashrom: Do not attempt to change the physical ID after setup() 2021-04-22 15:37:24 +01:00
Richard Hughes
378aceae7d flashrom: Never add NULL instance IDs
Probably fixes half of https://github.com/fwupd/fwupd/issues/3156
2021-04-20 15:09:58 +01:00
Richard Hughes
759c0d49e2 flashrom: Make using fu_flashrom_device_set_programmer_name() more safe 2021-04-20 15:09:58 +01:00
Richard Hughes
2f1f218a36 flashrom: Remove unused parent_instance struct member 2021-04-20 15:09:58 +01:00
Daniel Campello
08236d839d flashrom: make fu-flashrom-device derive from fu-udev-device
This change allows the flashrom plugin to probe for udev devices.
2021-04-08 18:12:16 -06:00
Daniel Campello
f37dcd4fab flashrom: make fu-flashrom-device a derivable type
This change allows other device types to derive from common flashrom
code in the flashrom-device type.

Change-Id: Ic963fd586e0a73153c54889fce50055753a1bf5c
2021-04-08 15:40:41 +01:00
Daniel Campello
f82ce6ecb6 flashrom: Update plugin to support multiple devices
This change moves many of the logic at the plugin level to the device
level in order to support multiple devices updatable via libflashrom.
2021-04-01 16:40:09 +01:00
Richard Hughes
aa95f30390 Allow reading the PciBcrAddr quirk from flashrom devices 2021-03-15 18:30:05 +00:00
Richard Hughes
d94286b9de Allow enabling plugins only matching a specific HwId
At the moment plugins are doing this a few different ways; either looping
through the HwIds manually (e.g. flashrom) or setting a custom flag that is
checked in fu_plugin_setup (e.g. uefi-recovery).

Define a standard 'Plugin' HwId quirk to simplify plugins.
2021-03-02 18:19:45 +00: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
6101067f03 coreboot: Remove plugin and instead add metadata to flashrom devices
The coreboot plugin never actually gained the ability to write. As it stands a
coreboot system now adds *two* system-firmware devices (from both flashrom and
coreboot) which isn't ideal.

Just allow flashrom to enumerate quirked devices and add coreboot-specific
metadata as required. If we require some kind of cbfs parsing then we can do
that in FuFlashromDevice->prepare_firmware().
2021-01-19 21:32:59 +00:00