Commit Graph

1633 Commits

Author SHA1 Message Date
Mario Limonciello
5972a49495 Add a new plugin for CPU microcode 2020-03-09 09:04:38 +00:00
Mario Limonciello
6a0f25f649 trivial: uefi: restore uefi.quirk
It was a casualty in 6f8a3da8f0
2020-03-06 12:10:15 +00:00
Richard Hughes
a32034b844 Drop UEFI quirks we now inherit from metadata
Fixes https://github.com/fwupd/fwupd/issues/1843
2020-03-06 12:10:15 +00:00
Mario Limonciello
b87d48a042 When TPM PCR0 measurements fail, query if secure boot is available and enabled
If the measurements are missing but it's a UEFI system, it's a good indication
that the user has secure boot turned off.
Notify the user on the UEFI device through a non-fatal `UpdateMessage`

To accomplish this, move fu-uefi-vars into the plugin library for other plugins to use
2020-03-05 07:54:15 -06:00
Mario Limonciello
be1a555737 trivial: uefi: set vendor ID on dummy device 2020-03-05 07:54:15 -06:00
Tilmann Meyer
9f137339e9 ata: Add OUI quirk for Western Digital and Intel 2020-03-04 19:29:36 +00:00
Richard Hughes
6dd54fa9c4 vli: Set the MSP430 version format to pair
Apparently the Windows tool ignores the first byte, so we should too.
2020-03-03 14:19:42 +00:00
Mario Limonciello
29e085f441 trivial: send users to a wiki page for TPM PCR0 construction errors 2020-03-02 11:53:18 -06:00
Richard Hughes
9e54fc595a ata: Add trivial OUI quirk for Micron 2020-03-02 13:58:38 +00:00
Richard Hughes
1beec89c57 nvme: Do not try to handle integer version numbers
We've never come across a drive that uses anything other than plain.
2020-02-27 13:26:00 +00:00
Richard Hughes
b097603800 Allow server metadata to set the version format on some devices
It appears just choosing 'if Dell then QUAD else TRIPLET' isn't good enough.
2020-02-26 15:45:40 +00:00
Richard Hughes
cfde249435 Inihbit all power management actions using logind when updating
Fixes https://github.com/fwupd/fwupd/issues/1814
2020-02-25 14:31:46 +00: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
Mario Limonciello
c1776c9ad4 Add raw versions for bootloader and lowest
The assumption is that same version format is used for all 3 of these
versions.
2020-02-25 12:20:51 +00:00
Mario Limonciello
1afe177696 trivial: add an OUI quirk for a seagate disk 2020-02-24 17:16:20 +00:00
Richard Hughes
f43381f4a7 Allow server metadata to set the device name on some devices
This does 'bleed' the metadata contents into areas previously covered by quirks,
but in this case may be pragmatic and more up to date than a build-time
generated quirk file, which increases the user-friendliness of fwupdmgr.
2020-02-24 14:15:34 +00:00
Richard Hughes
9113f3edd1 trivial: Add a OUI quirk for Intel 2020-02-21 12:07:47 +00:00
Richard Hughes
dac0bc5fb7 trivial: Ensure the OUI quirk required prompt starts on a new line 2020-02-21 12:06:32 +00:00
Richard Hughes
dbcc8e1137 ata: Include a vendor ID for ATA hardware
Some vendors want to ship updates for ATA hardware, but there are currently no
lock-down restrictions in place for these kind of devices.

There is the OUI from the WWN block which is supposed to identify the vendor,
but this is not always set and so we have to be a little creative. We can match
90% of hardware using the vendor name prefix, and the last 10% can be detected
with a heuristic that was the result of comparing over 900 drive models.

I'm not including very old drive models, media converters, raid controllers,
or external 'portable' drives as I don't think it is useful. Also, if the drive
contains a Dell vendor block just hardcode this as Dell rather than trying to
be clever.

Also ask the user to contribute OUI values if this data is found with no quirk
data as this is the only real sane way to manage this data long term.
The list of OUIs can be found here: http://standards-oui.ieee.org/oui.txt
2020-02-20 16:02:44 +00:00
Richard Hughes
52bbae8209 ata: Switch off the verbose logging by default 2020-02-20 16:02:44 +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
Mario Limonciello
9ee0e63e53 trivial: add some better descriptions for man pages
Since more utilities are now in `bindir`, they should be more descriptive.
2020-02-20 09:34:10 -06:00
Mario Limonciello
b2dc3d481f Improve the description of fwupdtpmevlog for man page 2020-02-20 09:02:11 -06:00
Mario Limonciello
9fa7b38ac1 Move fwupdtpmevlog into bindir 2020-02-20 09:02:11 -06:00
Mario Limonciello
21e7faa78b uefi: Move fwupdate into bindir
Intended to be executed by users for debugging purposes, create a man
page as well.
2020-02-20 09:02:11 -06:00
Richard Hughes
334ba7994c trivial: Add helper fu_plugin_get_config_value_boolean() 2020-02-20 14:55:10 +00:00
Richard Hughes
6f8a3da8f0 Generate an additional UEFI quirk file using the stable LVFS metadata
The UEFI ESRT table just gives us a table of GUIDs with some basic flags, and
isn't very useful to end users. This is acceptable for Dell as there is only
typically one ESRT entry, which is for the system firmware. On typical Lenovo
hardware there might be half-a-dozen different 'Device' entries which all look
very similar.

As it's not possible to get a channel-of-data from the ODMs to fwupd, use the
existing LVFS metadata to generate some better names for these devices.
Although this looks like a lot of repeated data, libxmlb helpfully dedupes the
strings for us, making the quirk store only slightly larger.

Also, I've deliberately made this a manual step as we're not going to have
internet access on distro builders, and I'd also like the fwupd tarball output
to be deterministic and repeatable.
2020-02-14 17:14:24 +00:00
Bhaskar Upadhaya
73461ca1b7 uefi: Apply capsule update even with single valid capsule
Currently if there is an invalid boot entry for firmware update, the fwupd
EFI program will not call UpdateCapsule(), even if there is a valid entry.

For example, if the following entries exist the firmware update will fail:

HD(1,GPT,A672BBCA-325E-4D6F-91E1-DD57FAA85A9C)/\EFI\rhel\fw\fwupdate-6cialq.cap ... /*Valid entry*/
HD(1,GPT,E8176B29-6F73-43F2-AE8E-05E09DE20EE5)/\EFI\fedora\fw\fwupd-6dcbd5ed-e82d-4c44-bda1-7194199ad92a.cap ... /*InValid entry*/

Ensure capsule update is happening even if a valid capsule entry exists.

Signed-off-by: Bhaskar Upadhaya <bupadhaya@marvell.com>
2020-02-14 15:37:08 +00:00
Richard Hansen
a1edff9ab1 ebitdo: Fix the endpoint address logged in the error message
Addresses #1681.
2020-02-14 06:07:37 +00:00
Richard Hughes
52cda3db9c uefi: Find the correct lds and crt name when specifying -Defi_ldsdir
This fixes the Flatpak build of fwupd.
2020-02-13 17:56:33 +00:00
Mario Limonciello
7a3985f2de upower: Move battery threshold declaration into a configuration file 2020-02-13 09:52:20 -08:00
Mario Limonciello
e396f62d74 upower: Decrease minimum battery requirement to 10%
Dell's behavioral spec for this aligns the threshold for this at 10%
rather than 30%.
2020-02-13 09:52:20 -08:00
Richard Hughes
22edab6da8 altos: Output raw buffer data when using FWUPD_ALTOS_VERBOSE 2020-02-12 17:15:48 +00:00
Richard Hughes
1a76852d74 altos: Prefix an error to provide more context 2020-02-12 17:15:48 +00:00
Richard Hughes
f0eeceb9e9 altos: Add a trivial _to_string() implementation 2020-02-12 17:15:48 +00:00
Richard Hughes
48a9da5091 synaptics-cxaudio: Make the verfmt match that of the existing Windows tools
This is causing too much confusion, and we don't actually need to force to a
dotted decimal for any reason.
2020-02-12 17:15:40 +00:00
Richard Hughes
de5573c68b synaptics-mst: Allow MST to fall back if no PCI device is marked as parent
At the moment not having a udev parent was causing the dock device to not be
detected.
2020-02-12 17:15:28 +00:00
Richard Hughes
bc49d019cd synaptics-mst: Fix trivial thinko caused by the wrong dock connected 2020-02-12 09:48:07 +00:00
Richard Hughes
ea71dc7e73 vli: Invert the logic to reboot the parent FuCliUsbhubDevice, not the child 2020-02-12 08:51:24 +00:00
Richard Hughes
e20d6b3c33 vli: Switch around the hub tier values
I got given the wrong values...
2020-02-12 08:50:48 +00:00
Richard Hughes
d2fe61289b uefi: Fix a build regression with Fedora 30
Fixes https://github.com/fwupd/fwupd/issues/1754
2020-02-11 14:53:01 +00:00
Mario Limonciello
ddfc72db56 logitech_hidpp: Ignore detach failures (Fixes: #1183)
Some logitech devices seem to reboot immediately and the failures then
look like a broken pipe, but are actually the device rebooting.

If the device really did fail to detach after the timeout is done we'll
see a message that the device failed to come back instead.
2020-02-11 14:14:51 +00:00
Mario Limonciello
38d7074215 logitech_hidpp: When detaching to bootloader use non-blocking IO and wait for timeout
Should hopefully resolve issues that take a long time for devices to reboot.
Fixes: #1667
2020-02-11 14:14:51 +00:00
Richard Hughes
2b108e4ab1 vli: Show erase progress when doing a v2 recovery 2020-02-11 13:40:05 +00:00
Richard Hughes
60373e03fd uefi: Do not remove the 'Linux Firmware Updater' boot entry before update
Deleting boot entries from EFI sometimes triggers problems on some firmware.

We don't actually need to do it from the EFI binary, and it's perfectly safe to
leave it in the boot list. It also means when doing multiple updates over
several months we're not creating, deleting, creating, deleting and can just
re-use the same BootXXXX number each time.

It also makes the EFI binary simpler, which is good.
2020-02-11 13:36:08 +00:00
Richard Hughes
507f24a735 uefi: Do not rewrite BootOrder in the EFI helper
At the moment fwupd creates a BootXXXX for fwupd.efi and marks it BootNext.
It *also* adds it to the end of BootOrder to work around various old firmware
bugs like https://github.com/rhboot/fwupdate/issues/55 which we can perhaps
drop sometime thie century.

Remove the rewriting of BootOrder from the EFI binary; we've accidentally not
been doing it for a long time and nothing broke, and I'd like to make the EFI
binary as small and simple as possible. The user can remove the entry from the
BIOS or using efibootmgr if required, but it's harmless to just leave it.
2020-02-11 13:36:08 +00:00
Richard Hughes
00a0be068a vli: Add support for the PS186 device 2020-02-11 12:08:37 +00:00
Richard Hughes
af3b91d490 Set up more parent devices for various Lenovo USB hubs 2020-02-11 11:22:20 +00:00
Richard Hughes
1bd0617aac cxaudio: Set the update protocol to prevent a daemon warning 2020-02-11 11:18:44 +00:00
Richard Hughes
6c3db94f14 vli: Add support for Lenovo Modularized dock 2020-02-11 11:18:10 +00:00
Richard Hughes
e7e37ec223 vli: Remove the unused tierX custom flags for each device
We now know what this means on real hardware!
2020-02-10 14:58:38 -06:00
Mario Limonciello
d5bf8e45f2 Revert "Correctly delete UEFI variables"
This reverts commit 44f55e2ee6.

This behavior caused fwupdx64.efi to loop for a very long time until
either aborting, running out of memory or some other problems.
Fixes: #1756
Fixes: #1751
2020-02-10 12:39:26 -06:00
Mario Limonciello
bcd14de89f uefi: make debugging output more readable 2020-02-10 12:39:26 -06:00
Richard Hughes
ef168b289e vli: Fix a potential buffer-overflow when parsing firmware
Spotted by Coverity.
2020-02-07 15:16:39 +00:00
Richard Hughes
b27f0d42f9 tpm: Optimize the string parsing and fix the boolean logic
The g_ascii_isgraph() correctly handles NUL so just remove the check rather
than adding brackets around the logic.
2020-02-07 15:16:39 +00:00
Richard Hughes
04fde48e9a synaptics-rmi: Add a missing error enum value
This was spotted whilst fixing the last bug...
2020-02-07 15:16:39 +00:00
Richard Hughes
9baaacc099 synaptics-rmi: Correctly identify a checksum failure
The typo was spotted by Coverity.
2020-02-07 15:16:39 +00:00
Richard Hughes
2f85c24363 synaptics-rmi: Fix Coverity issue that is impossible to hit in reality
The guint16 was promoted to (signed) int for the multiplication, which meant
that the highest address possible was 0x7FFFFFFF not 0xFFFFFFFF. Which doesn't
really matter in reality, as all addresses are much smaller than that now.
2020-02-07 15:16:39 +00:00
Richard Hughes
072efbde88 trivial: Fix broken commit
I didn't actually mean to push this, but as I did, lets make it at least compile...
2020-02-07 12:04:03 +00:00
Richard Hughes
af7c098df2 solokeys: Parse old versions of the bootloader string 2020-02-07 11:49:01 +00:00
Richard Hughes
1910e84c72 Add a plugin to update PD controllers by Fresco Logic 2020-02-07 11:46:25 +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
e17dd6f0cd vli: Use the correct command to get the device firmware version
Mea culpa; I misread the example code. It's a different command entirely.
2020-02-06 20:38:19 +00:00
Richard Hughes
6afe612c2f vli: Correctly reset all VL100 devices
The reset happens before the USB transfer completes.
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
9d22db26f9 vli: Mark standalone PD devices as updatable 2020-02-06 20:38:19 +00:00
Richard Hughes
003c150cc2 vli: Set the protocol for FuVliUsbhubPdDevice types 2020-02-05 17:23:51 +00:00
Richard Hughes
7d11d44242 Support the new gnuefi file locations
gnu-efi 3.0.11 moves a few files around, e.g.

    /usr/lib64/gnuefi/elf_x64_efi.lds -> /usr/lib64/gnuefi/x64/efi.lds

...and this causes the UEFI EFI helper to fail to link.

Add support for the 'new' paths and fall back to the old ones.

Fixes https://github.com/fwupd/fwupd/issues/1736
2020-02-05 07:41:35 -06:00
Mario Limonciello
8527405c8d Cleanup ancient fwupdate-* EFI variables too (Fixes: #1739)
It seems that fwupd.efi is picking up both fwupdate-* and fwupd-*
entries that are sitting around in efivarfs.
2020-02-04 11:36:58 -06:00
Mario Limonciello
9dce1f7011 Detect kernel lockdown status
Disable superio when kernel lockdown in effect.
2020-02-04 10:08:25 -06: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
59d947ac24 tpm-eventlog: Replay the TPM event log to get the PCRx values
In theory, these should always match the reported PCRx values from the TPM.

If the reconstructed event log checksum does not match the TPM value then
something is either implemented wrongly, or something bad has happened.
2020-02-04 11:54:27 +00:00
Richard Hughes
ca3e785c40 tpm-eventlog: Store the eventlog hashes in binary form
This means we use half the amount of memory to store the event hashes, and also
means we can process the raw data in future patches without parsing back out
of ASCII format.
2020-02-04 11:54:27 +00:00
Ivan Hu
44f55e2ee6 Correctly delete UEFI variables
UEFI runtime service GetVariable with DataSize NULL, will fail and get
EFI_INVALID_PARAMETER returned. Set DataSize 0 and allocate the buffer for
getting attributes for the deleted variable.

Also, fix the real reason Boot#### was never found.
2020-01-30 16:52:41 +00:00
Mario Limonciello
da2adf0e6f trivial: synaptics-mst: adjust last part of triplet to be 2 digits not 3
Synaptics versions are encoded as BCD, the largest version that will
ever be represented in this field is '99'.

Using 3 digits in this field has caused multiple problems in upgrades from
LVFS.

1. Devices are being upgraded when not necessary.
IE `5.3.10 > 5.3.010`

2. Device upgrades are deemed failures as follows:

```
BootTime=1571436076,
CompileVersion(com.redhat.efivar)=37,
CompileVersion(com.redhat.fwupdate)=12,
CompileVersion(org.freedesktop.fwupd)=1.3.2,
CompileVersion(org.freedesktop.gusb)=0.3.0,
CpuArchitecture=x86_64,
DistroId=fedora,
DistroVariant=workstation,
DistroVersion=32,
FirmwareId=1915,
Flags=4194346,
Guid=f15aa55c-9cd5-5942-85ae-a6bf8740b96c,
MachineId=97aa89528b88d9631867a4e20c68a5208124ef592e19d05f0c5e7d22bd4d7afb,
Plugin=synapticsmst,
RuntimeVersion(com.dell.libsmbios)=2.4,
RuntimeVersion(com.redhat.fwupdate)=12,
RuntimeVersion(org.freedesktop.appstream-glib)=0.7.14,
RuntimeVersion(org.freedesktop.fwupd)=1.3.2,
RuntimeVersion(org.kernel)=5.4.0-0.rc2.git2.1.fc32.x86_64,
UpdateError=device version not updated on success, 05.03.10 != 5.03.010,
UpdateState=failed,
VersionNew=05.03.10,
VersionOld=5.03.010

```
2020-01-22 15:22:11 -06:00
Richard Hughes
47862828e1 trivial: Allow setting an ID of NULL for the FuFirmwareImage
There's no reason to prevent NULL, and doing so means the caller has to check
before setting the value. Only one subclassed type was actually doing this...
2020-01-16 11:24:55 -06:00
Richard Hughes
b1fd77780f trivial: Fix a tiny memory leak introduced with the UPower fix 2020-01-16 15:29:08 +00:00
Richard Hughes
6b8c261225 Disable the battery percentage checks if UPower is unavailable
Based on a patch by Crag Wang <Crag.Wang@dell.com>, many thanks.
2020-01-15 15:54:00 +00:00
Richard Hughes
21eaeeff8d trivial: Fix up some typos found using codespell 2020-01-14 12:25:41 +00:00
Mario Limonciello
0dd8db545e trivial: tpm-eventlog: correct a typographical error 2020-01-09 10:42:08 -06:00
Mario Limonciello
bd266bd0cf trivial: add some missing protocol definitions 2020-01-08 15:49:38 -06:00
Mario Limonciello
7442b7ba77 synaptics-mst: Skip self tests for systems with amdgpu
No need to fail these self tests when using amdgpu, just skip them.
Fixes unrelated issue found in #1183

Signed-off-by: Richard Hughes <richard@hughsie.com>
2020-01-08 08:44:01 +00:00
Richard Hughes
af14073522 Allow applying all releases to get to a target version
Some hardware does not handle upgrading from version 1.2.2 to 1.2.4 and instead
needs to be upgraded from 1.2.2->1.2.3->1.2.4 so that on-device metadata can be
migrated correctly.

Add a new per-device flag `install-all-releases` which causes the daemon to not
skip directly to the newest release. This is designed to be set from a quirk
file.

This can obviously only be used for devices that can apply firmware "live" and
thus do not need a reboot or system shutdown to actually apply the firmware.
This also needs the cabinet archive to ship multiple versions of the firmware,
and for the metainfo.xml file to refer to multiple release objects.
2020-01-07 15:33:12 +00:00
Mario Limonciello
2d172534a8 logitech_hidpp: use the correct timeout for IO channel writes 2020-01-07 08:12:23 -06:00
Richard Hughes
63b9ac8844 Don't always get the vendor ID for udev devices using the parent
Fixes bugs like https://github.com/fwupd/fwupd/issues/1673
2020-01-06 14:48:58 +00:00
Richard Hughes
7f765005e2 Add a runtime warning when adding a device without an vendor-id or protocol set
Also, allow setting the protocol in the quirk file if required.
2020-01-06 14:48:32 +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
fbffb16378 vli: Use a different protocol ID for i2c devices
These devices report a triplet version format, not a quad.
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
c12163b374 vli: Remove the PD emulation code
I have actual hardware now...
2020-01-02 13:24:13 +00:00
Richard Hughes
714c4ce9d3 vli: Use a more standard GUID for the child i²c and shared SPI devices
We sometiems need to restrict the firwmare to the parent VID:PID too.
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
050f998835 vli: Make more function names match the docs 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
8b5a560b1c vli: Rename FuVliUsbhubPdFirmware to FuVliPdFirmware
This is used by non-usbhub devices too, albeit at offset 0x0.
2020-01-02 13:24:13 +00:00
Richard Hughes
617bd7025f vli: Allow the device to specify the PD firmware header offset
We only want a non-0x0 offset for firmware with a prepended USB hub header.
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
Richard Hughes
62b84d4c5b vli: Define the device GType in the quirk file
This allows us to define different types of devices in the future.
2020-01-02 13:24:13 +00:00
Richard Hughes
15857f8056 vli: Move the CRC calculations out of usbhub scope 2020-01-02 13:24:13 +00:00
Richard Hughes
e968c0ec07 vli: Have one 'DeviceKind' for all objects
We'll soon have PD devices that are not children of the FuVliUsbhubDevice and
so it makes sense to flattern out the namespace. Also, less code.
2020-01-02 13:24:13 +00:00
Richard Hughes
f169186700 vli: Rename the vli_usbhub plugin to vli
In the future we'll be doing PD updates without any USB hub at all.
2020-01-02 13:24:13 +00:00
Michael Forney
9bdb96f768 plugins/coreboot: Add missing fu_hash dependency
This fixes the build when using samurai in place of ninja.
2019-12-18 08:33:10 +00:00
Mario Limonciello
171758180d trivial: synaptics-cxaudio: Add Google type C <-> 3.5mm adapter 2019-12-15 20:17:42 -06:00
Mario Limonciello
a21802acad trivial: dell-dock: drop unused quirk keyx 2019-12-12 13:59:41 -06:00
Mario Limonciello
fd6ffd6dac trivial: rename synapticsmst to synaptics-mst
This brings the naming nomenclature inline with the other plugins
2019-12-12 13:59:41 -06:00
Mario Limonciello
a906cef924 trivial: actually set vendor ID for synaptics
The `README.md` was updated, but this device wasn't actually setting
a vendor ID.
2019-12-12 13:59:41 -06:00
Mario Limonciello
fc326d9ad4 trivial: synaptics-rmi: hardcode Vendor string
Right now vendor string is detected by walking up the udev chain
until a vendor is found.  On some systems this is finding incorrect
data such as `Intel Corporation` for the vendor on the touchpad.

As the plugin only supports Synaptics devices, Correct it by hardcoding
vendor to `Synaptics`.

Sample output:
```
└─Touchpad:
      Device ID:           b26933c085b020ecf84c490812458523aee710ac
      Current version:     1.5.2767034
      Bootloader Version:  54.0
      Vendor:              Synaptics (HIDRAW:0x06CB)
      GUIDs:               f4384034-9243-5334-8075-a534be913e46 ← HIDRAW\VEN_06CB&DEV_76AF&REV_00
                           424bd00e-9789-5cdf-a12a-3c81bc4676d6 ← HIDRAW\VEN_06CB&DEV_76AF
                           140f4458-951b-5bb9-85e2-879bd5b02615 ← SYNAPTICS_RMI\TM3038-003
                           b29d3c85-cd0e-503e-9c7e-f6731c1eaf2d ← SYNAPTICS_RMI\TM3038
      Device Flags:        • Internal device
                           • Updatable
```
2019-12-12 09:57:47 -06:00
Mario Limonciello
e2db568490 trivial: Set vendor ID for Dell WD19 to USB:0x413C (Fixes: #1653)
View after this update:
```
├─WD19TB:
│ │   Device ID:           a455a3a21752e5d31c228f1f5b51761dad88a432
│ │   Summary:             High performance dock
│ │   Current version:     01.00.00.02
│ │   Minimum Version:     01.00.00.00
│ │   Vendor:              Dell Inc. (USB:0x413C)
│ │   Install Duration:    1 minute
│ │   Serial Number:       J4T6SV2/3169046018716226
│ │   GUID:                cd357cf1-40b2-5d87-b8df-bb2dd82774aa ← USB\VID_413C&PID_B06E&hub&embedded
│ │   Device Flags:        • Updatable
│ │                        • Requires AC power
│ │                        • Supported on remote server
│ │                        • Device stages updates
│ │                        • Device can recover flash failures
│ │                        • Device is usable for the duration of the update
│ │
│ ├─Thunderbolt controller in Dell dock:
│ │     Device ID:         8357922f7f208e1f3b7537141ce17db04bc219d9
│ │     Summary:           Thunderbolt controller
│ │     Current version:   43.00
│ │     Vendor:            Dell Inc. (TBT:0x00D4)
│ │     Install Duration:  22 seconds
│ │     GUID:              c94770ca-1773-592c-b20a-e87243bc7cd0 ← TBT-00d4b070
│ │     Device Flags:      • Updatable
│ │                        • Requires AC power
│ │                        • Supported on remote server
│ │                        • Device stages updates
│ │
│ ├─Package level of Dell dock:
│ │     Device ID:         1eca9eabb0c992c136e1deb1f89e3f70c465aa1c
│ │     Summary:           A representation of dock update status
│ │     Current version:   01.00.08.01
│ │     Vendor:            Dell Inc. (USB:0x413C)
│ │     Install Duration:  5 seconds
│ │     GUID:              8ceeeffd-51b6-580c-9b75-69143227aff8 ← USB\VID_413C&PID_B06E&hub&status
│ │     Device Flags:      • Updatable
│ │                        • Supported on remote server
│ │                        • Device can recover flash failures
│ │                        • Device is usable for the duration of the update
│ │
│ ├─RTS5413 in Dell dock:
│ │     Device ID:         ca36279eeac13463fd5d974c88794859294fbfb1
│ │     Summary:           USB 3.1 Generation 1 Hub
│ │     Current version:   01.21
│ │     Vendor:            Dell Inc. (USB:0x413C)
│ │     Install Duration:  14 seconds
│ │     GUIDs:             86fb40c0-8bf5-5a8b-a4ad-3156cf6bfaf4 ← USB\VID_413C&PID_B06F&REV_0101
│ │                        b27d25f1-019d-5718-b41a-02ddaefe5577 ← USB\VID_413C&PID_B06F
│ │                        ac5b774c-b49d-566b-9255-85f0f7f8a4ed ← USB\VID_413C&PID_B06F&hub
│ │     Device Flags:      • Updatable
│ │                        • Requires AC power
│ │                        • Supported on remote server
│ │                        • Device stages updates
│ │                        • Device is usable for the duration of the update
│ │
│ ├─RTS5487 in Dell dock:
│ │     Device ID:         acb404019656654d44f80922d94735e831d9bb40
│ │     Summary:           USB 3.1 Generation 2 Hub
│ │     Current version:   01.47
│ │     Vendor:            Dell Inc. (USB:0x413C)
│ │     Install Duration:  3 seconds
│ │     GUIDs:             707c63d2-e597-5c40-84db-9b1bb4c48d96 ← USB\VID_413C&PID_B06E&REV_0101
│ │                        acfcd89b-105d-55b9-b85b-08bf8508f38c ← USB\VID_413C&PID_B06E
│ │                        568ffa1e-a0db-5287-9ea3-872b60f7730b ← USB\VID_413C&PID_B06E&hub
│ │     Device Flags:      • Updatable
│ │                        • Requires AC power
│ │                        • Supported on remote server
│ │                        • Device stages updates
│ │                        • Device is usable for the duration of the update
│ │
│ └─VMM5331 in Dell dock:
│       Device ID:         58931e8c9ef5eead9c007563814f96fcadb1b993
│       Summary:           Multi Stream Transport controller
│       Current version:   05.04.00
│       Vendor:            Dell Inc. (USB:0x413C)
│       Install Duration:  6 minutes
│       GUID:              89fec0b6-6b76-5008-b82c-5e5c6c164007 ← MST-panamera-vmm5331-259
│       Device Flags:      • Updatable
│                          • Requires AC power
│                          • Supported on remote server
│                          • Device stages updates
│                          • Device is usable for the duration of the update
```
2019-12-12 09:44:20 -06:00
Richard Hughes
0cc22a5ff6 trivial: Document the use of vendor-id in each plugin 2019-12-11 18:10:44 +00:00
Richard Hughes
d3d64b5b54 superio: Use the baseboard vendor as the vendor ID 2019-12-11 18:10:44 +00:00
Richard Hughes
56700a3db8 uefi: Use the BIOS vendor as the vendor ID
This is only set for non-FMP ESRT entries.
2019-12-11 18:10:44 +00:00
Richard Hughes
89425b01bd coreboot: Use the BIOS vendor as the vendor ID 2019-12-11 18:10:44 +00:00
Richard Hughes
49eeca05d0 flashrom: Use the BIOS vendor as the vendor ID 2019-12-11 18:10:44 +00:00
Richard Hughes
3544ac03b3 dell: Hardcode a plausible vendor ID 2019-12-11 18:10:44 +00:00
Richard Hughes
d1b9bbd842 emmc: Set the correct vendor ID prefix 2019-12-11 18:10:44 +00:00
Richard Hughes
038d8f463e vli-usbhub: Fix the quirk for the legacy VIA 813 chip 2019-12-10 14:02:13 +00:00
Richard Hughes
f5c6e1d276 Add a new plugin that can parse the TPM event log
Some devices do not have a stable PCR0 for the same firmware version, and I'd
like to collect the TPM event log for affected machines to debug why.
2019-12-06 15:05:16 +00:00
Mario Limonciello
ad311189d4 trivial: dell: hardcode the physical device ID for tpm to match the tpm plugin
This allows the better-than logic to work properly.
2019-12-05 21:05:17 +00:00
Richard Hughes
fbb677bee2 Add a new plugin that exposes the system TPM device firmware version
This plugin does not yet allow the device to be upgraded, and is provided for
information only.
2019-12-05 21:05:17 +00:00
Richard Hughes
6c924a69c4 Add fu_udev_device_set_flags()
This allows us to specify with more detail how the device is opened.
2019-12-05 14:08:48 -06:00
Mario Limonciello
bda8bdf0e6 trivial: wacom-raw: mark all Moffett SKUs as self recovery
These will all support the recovery feature added by 59970600ad
2019-12-05 08:05:49 -06:00
Richard Hughes
f1a7122250 Add a dell-bios version format
Dell does not include the first byte in the ESRT value, ignoring it. Using a
`quad` means we get versions like `0.1.4.0` rather than `1.4.0` which confuses
both users comparing versions to the vendor website, and also anyone trying to
do analysis on the firmware.
2019-12-04 16:22:46 +00:00
Vincent Huang
3e3a0277c9 synaptics-prometheus: Allow incremental version major and minor number 2019-12-03 11:06:52 +00:00
Richard Hughes
10079e6b8c Export the raw device version to the client --verbose output
It turns out this is really useful for debugging UEFI firmware updates which
typically use the 0x-prefixed version numbers without a version format.
2019-12-02 06:51:25 +00:00
Richard Hughes
297d1598ef trivial: Only dlopen the test plugin once
This causes problems in the self tests when not lazy-loading symbols.

Also use g_build_filename() for the paths to be more portable and readable.
2019-12-01 20:59:19 +00:00
Francois Berder
bb5385de76 plugins: Fix potential use of NULL pointer in fu_dell_dock_mst_write_register
Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
2019-11-29 06:33:09 -06:00
Richard Hughes
1d797668fa synaptics-prometheus: Reload the device version after IOTA update 2019-11-29 12:04:42 +00:00
Richard Hughes
6d80b84b95 synaptics-prometheus: Reload the device version after update 2019-11-29 12:03:04 +00:00
Crag Wang
923120e55f trivial: wacom: remove coretronic config from Moffett scope 2019-11-28 06:37:53 -06:00
Richard Hughes
6aceaf9409 trivial: Fix a NULL/FALSE confusion 2019-11-27 16:36:17 +00:00
Richard Hughes
6e5fd3b3d8 trivial: Fix coreboot commit to fix CI 2019-11-27 14:40:49 +00:00
Patrick Rudolph
b21c3af2ea plugins/coreboot: Improve version detection
Only on Lenovo devices the DMI version string is prefixed with
CBETxxxx to make the thinkpad_acpi kernel module happy.

Add a new quirk called "CorebootVersionQuirks" to detect platforms
that need to cut of the prefix.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
2019-11-27 14:26:26 +00:00
Patrick Rudolph
bd94740404 plugins/coreboot: Get rid of FU_HWIDS_KEY_BIOS_VENDOR in coldplug
In fu_plugin_startup we make sure that the FU_HWIDS_KEY_BIOS_VENDOR
matches "coreboot", so there's no need to read it again.

Remove the call to fu_plugin_get_dmi_value and drop the first call
to fu_device_set_vendor as it gets overwritten below.

Hardcode the id string for now.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
2019-11-27 14:26:26 +00:00
Richard Hughes
3ed2ac8315 trivial: Unexport fu_test_get_filename()
We don't actually need either of the things it provides (looking up in source
and built, and converting to an absolute path) so just replace it with
g_build_filename() instead.

This also has the advantage that it does the right thing on Windows.
2019-11-27 12:45:35 +00:00
Richard Hughes
606fa91dae trivial: Unexport fu_test_compare_lines()
It's only used two places in the self tests.
2019-11-27 12:45:35 +00:00
Richard Hughes
aed7826c8f trivial: Properly namespace the defines in the exported header 2019-11-27 12:45:35 +00:00
Mario Limonciello
6b0e66354b Convert libfwupdprivate to a shared library libfwupdplugin 2019-11-27 11:32:43 +00:00
Richard Hughes
9e5675e1b4 trivial: Allow compiling without <glib-unix.h> 2019-11-26 17:15:45 +00:00
Richard Hughes
f0f504c740 trivial: Do not use FuProgressbar in dfu-tool
This is a debug-only command line program, and we don't want plugins to have
access to the animated progressbar header in the future.
2019-11-26 17:15:18 +00:00
Richard Hughes
ed3f6cfd4f synaptics-prometheus: Manually set the bootloader mode when attaching
The fingerprint reader device doesn't actually disconnect and reconnect and
so the FuDevice->setup() vfunc never gets called.
2019-11-26 14:15:11 +00:00
Richard Hughes
aba4a5a2bd trivial: Split out a new helper funtion
Other devices need to use this functionality too.
2019-11-26 14:15:11 +00:00
Richard Hughes
11d10a00e7 Always use the more portable 3-arg form for open() 2019-11-26 14:14:37 +00:00
Richard Hughes
5c508de173 trivial: Allow compiling without <fnmatch.h>
This also allows us to add a Win32 implementation if required in the future.
2019-11-26 13:13:31 +00:00
Richard Hughes
28e8b953d0 Revert "synaptics-rmi: Use the build ID as the version number to match the vendor tool"
This reverts commit 28ab968cbf as Synaptics
deviced that vmajor and vminor would actually be useful.
2019-11-26 08:25:45 +00:00
Richard Hughes
cb59a44f28 synaptics-prometheus: Mirror the _IS_BOOTLOADER from device to config 2019-11-25 18:10:38 -06:00
Richard Hughes
741e1e5323 vli_usbhub: Set the composite parent at construction time 2019-11-25 20:01:33 +00:00
Richard Hughes
0df243ad44 synaptics-prometheus: Set the composite parent at construction time 2019-11-25 20:01:33 +00:00
Richard Hughes
52e15b8fb3 vli-usbhub: Whitelist the PD and I²C devices
On advice from VIA.
2019-11-25 12:36:13 -06: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
28ab968cbf synaptics-rmi: Use the build ID as the version number to match the vendor tool 2019-11-25 17:44:25 +00:00
Richard Hughes
1665837e78 Make gudev a compile-time option
This should make it nearly possible to build fwupd on FreeBSD.
2019-11-25 09:29:46 +00:00
Richard Hughes
afdba37644 trivial: Set the offline trigger using an environment variable
This allows us to build a object that does not have a custom FU_OFFLINE_DESTDIR.
2019-11-25 09:29:46 +00:00
Mario Limonciello
6abe21efbd trivial: stop including fu-hash.h as part of fu-plugin-vfuncs.h
Explicitly include it in all "in-tree" plugins.

If headers are exported out of tree we will likely explicitly not
export this header.
2019-11-25 09:29:46 +00:00
Leo
6640b571bf Fix shebangs on scripts 2019-11-24 18:51:56 -06:00
Richard Hughes
668ee21567 trivial: Use prefixes for DATADIR in config.h for portability
DATADIR is an enumerated type in MinGW, and the other names are very generic.
2019-11-24 14:17:38 -06:00
Mario Limonciello
89a9e245f9 trivial: optionrom: remove unneeded includes 2019-11-23 14:34:55 -06:00
Richard Hughes
633445dc10 trivial: Allow compiling without <errno.h> 2019-11-23 17:07:53 +00:00
Richard Hughes
8694dee4e7 trivial: Allow compiling without realpath() 2019-11-23 17:07:53 +00:00
Richard Hughes
01c0badd38 trivial: Allow compiling without getuid() 2019-11-23 17:07:53 +00:00
Mario Limonciello
0f54b54250 trivial: plugins: only build coreboot when option set
The option was set but wasn't being used.
2019-11-22 14:50:15 -06:00
Richard Hughes
18b0a739e2 dell: Use the more portable g_usleep() 2019-11-22 14:23:48 +00:00
Richard Hughes
7eeebae1c7 vli-usbhub: Make erasing less verbose and writing more obvious 2019-11-22 14:07:39 +00:00
Richard Hughes
ae21b15ec1 vli-usbhub: Correctly print the 24-bit USB3 offset 2019-11-22 14:07:39 +00:00
Richard Hughes
ad7c7e5fb3 vli-usbhub: Print the PD firmware offset and size for debugging 2019-11-22 14:07:39 +00:00
Richard Hughes
233868124e vli-usbhub: Open the parent device before attempting to read or write from the child 2019-11-22 14:07:39 +00:00
Richard Hughes
6496f12b37 vli-usbhub: Set the install duration for the PD device 2019-11-22 14:07:39 +00:00
Richard Hughes
24ce9837e9 trivial: Fix a failed error prefix string 2019-11-22 14:07:39 +00:00
Mario Limonciello
8bcaad800e trivial: wacom-raw: Remove embedded from device name
This is already implied by the internal flag.
2019-11-21 13:03:12 -06:00
Mario Limonciello
59970600ad wacom-raw: Correct HWID support
This support was using the wrong commands to add a HWID and thus
never actually functioned.  Furthermore it's purpose is to pull
the PID out of the bootloader to be able to properly identify
the device when in bootloader mode (as in recovery mode).

When in this state, generate the correct instance IDs for both
possible Wacom VID.  We can't tell which Wacom VID we are in
bootloader mode.
2019-11-21 13:03:12 -06:00
Richard Hughes
fdb4c4507b uefi: Just use a uint16_t for BootNext processing
This makes everything simpler, at the expense of not being able to create a
`BootFFFF` entry -- but if we get that far something has already gone very
wrong with the firmware...
2019-11-20 16:24:21 +00:00
Richard Hughes
5772e8451c uefi: Use a simpler entries set algorithm
Although slightly wasteful on memory, allocating 64kb is no big deal, and it
means we can simplify creation and reading a lot.
2019-11-20 16:24:21 +00:00
Richard Hughes
55b2df9df6 vli-usbhub: Add support for writing using I2C passthru 2019-11-20 11:07:23 +00:00
Richard Hughes
9f960c154a vli-usbhub: Support updating PD devices that share the hub flash 2019-11-20 11:07:23 +00:00
Richard Hughes
171f18c1c8 vli-usbhub: Support the PD file format 2019-11-20 11:07:23 +00:00
Mario Limonciello
66fcf55f9a trivial: uefi: correct a NULL pointer dereference
This could happen if the machine doesn't have `/etc/os-release`.
2019-11-18 16:22:01 -06:00
Mario Limonciello
e888b58ccd uefi: fall back to ID_LIKE when the path for ID doesn't exist (Fixes:# 1566)
Some derivative distributions re-use bootloader paths from their
upstream.  When this happens the current logic to look for the `ID`
key in `/etc/os-release` doesn't work properly.

Adjust the logic to:
1) Use `ID`
2) Test the path exists.  If so, use it.
3) If it doesn't use `ID_LIKE`.
4) Test if that path exists, if so use it.
5) If that path doesn't exist, return the key from `ID`
6) The plugin will make this path.
2019-11-18 14:55:04 -06:00
Jan Tojnar
34743c5fab uefi: Make generate_binary.sh more robust
command is a shell builtin unlike which, which might not be available.

While at it, let us also make the variables space-safe.
2019-11-18 18:43:40 +00:00
Richard Hughes
22c124dba4 trivial: Detect the USB version automatically
Unfortunately we can't remove the usb2 and usb3 custom flags as we don't yet
depend on a new enough GUsb version.
2019-11-15 18:59:44 +00:00
Mario Limonciello
e2b8a2797e Skip cleanup after device is done updating if will-disappear is set (Fixes: #1529)
This fixes a regression introduced by 2031ce3bf6
that leads to:
```
USB error on device 2dc8:5750 : No such device (it may have been disconnected) [-4]
```
2019-11-14 08:06:17 -06:00
YiFei Zhu
8b044c6cb3 efi: use a wildcard section copy for final EFI generation
The GNU gold linker uses the section name `.rela.dyn` instead of
`.rela` for containing the relocation information. If this section
is not copied the EFI executable can crash.

Fixes #1530
2019-11-14 09:46:50 +00:00
Aleksander Morgado
705f5b64e3 modem-manager: explicitly use plain version format
The devices managed by this plugin expose version strings that are to
be treated as plain ASCII and compared just as plain ASCII.
2019-11-13 17:41:22 +00:00
Aleksander Morgado
e66e0b7114 modem-manager: add quirks for the Foxconn T77W968 modules 2019-11-13 10:54:29 +00:00
Mario Limonciello
e8ec462e07 trivial: thunderbolt: clarify error message
In an error block that checks for `NULL` sysfs, you will always see
`(null)` in the string.

```
FuPluginThunderbolt  Unable to read generation: failed get id generation for (null)
```
2019-11-11 16:16:51 -06:00
Richard Hughes
d630b5ee66 superio: Never read from port offset zero
At this point, PM1 IOBAD0 is unset, and thus zero...
2019-11-08 17:51:43 +00:00
Richard Hughes
025fc77d7a superio: Fix regression when coldplugging superio devices
Fixes https://github.com/fwupd/fwupd/issues/1546
2019-11-08 17:51:43 +00:00
Mario Limonciello
9b944d8999 trivial: synapticmst: allow missing /proc/modules
If a kernel is compiled without loadable module support this shouldn't
stop synapticsmst plugin from loading, just we can't do an extra safety
check.
2019-11-08 09:52:02 -06:00
Mario Limonciello
5151aa5222 synapticsmst: filter invalid chip IDs
This device was showing up from a LG 38UC99-W USB-C monitor
```
VMM0000:
      Device ID:           d762543f8c20f636e6fff031a000078d3e10c600
      Summary:             Multi-Stream Transport Device
      Current version:     0.00.000
      Vendor:              Synaptics
      GUIDs:               42addef4-40f9-5e89-b925-d564e35ed368 ← MST-(null)-vmm0000-0
                           cf8c03c5-18bf-53c4-971f-4a08f88932b5 ← MST-(null)-0
                           e9427b6a-7389-5461-a592-1da5f8ec99fd ← MST-(null)
      Device Flags:        • Updatable
```
2019-11-08 09:45:39 -06:00
Richard Hughes
2414f24b8a trivial: Provide some defines for common image names 2019-11-08 09:30:09 -06:00
Richard Hughes
c5384e9173 Allow aborting early when using fu_archive_iterate() 2019-11-08 09:30:09 -06:00
Aleksander Morgado
0066195a2c modem-manager: increase re-enumeration delay to 20000ms
The default of 10000ms was a bit too close to the real time seen in
e.g. the DW5821e/eSIM.
2019-11-07 21:34:35 +00:00
Aleksander Morgado
def263e697 modem-manager: add counterpart GUID for the DW5821e/eSIM 2019-11-07 21:34:35 +00:00
Richard Hughes
1e98534e37 trivial: Fix the protocol ID for VLI usbhub devices 2019-11-07 09:37:34 +00:00
Mario Limonciello
330434550c trivial: wacom-raw: add more device IDs for Dell devices 2019-11-07 00:40:22 -06:00
Mario Limonciello
79ac523224 synaptics-rmi: correct an error cleaning up on probe
```
failed to close device: Bad file descriptor
```

fu-udev-device will open a locker automatically now.
However synaptics-rmi closes the file descriptor on it's own with `g_clear_object`.

So destroy the fd in synaptics-rmi.
2019-11-06 08:21:51 -06:00
Richard Hughes
6e55cff444 fastboot: Fix a regression when updating modem firmware
Set `IS_BOOTLOADER` unconditionally when in fastboot mode. This seems logically
what it is; a degraded mode that's able to update firmware without runtime
functionality.

Fixes https://github.com/fwupd/fwupd/issues/1532
2019-11-05 06:04:36 -06:00
Mario Limonciello
d8c8249d16 trivial: conflict with old unifying plugin 2019-11-04 13:35:36 -06:00
Mario Limonciello
5123d4333e Rename unifying plugin to logitech-hidpp (Fixes: #1329) 2019-11-04 13:35:36 -06:00
Richard Hughes
7cb0592f72 trivial: Fix a compile error with older versions of gudev
Just move the G_DEFINE_AUTOPTR_CLEANUP_FUNC to the internal header to avoid
forgetting to define this in each plugin.
2019-11-02 07:47:02 -05:00
Mario Limonciello
15e3137f81 trivial: wacom: add vid/pid for panels in Moffett 2019-11-01 14:23:15 -05:00
Mario Limonciello
6c5e7c1e92 unifying: notify users to replug when using dfu control (Fixes: #1383) 2019-11-01 14:31:03 +00:00
Mario Limonciello
2e06dcd5e3 trivial: 8bitdo: set a transient failure while waiting for user action 2019-11-01 14:31:03 +00:00
Mario Limonciello
8ecb08ec23 trivial: 8bitdo: show the same message for SN30pro and SN30pro+ 2019-11-01 14:31:03 +00:00
Richard Hughes
02792c0ba3 trivial: Fix up some typos from codespell 2019-11-01 14:21:20 +00:00
Richard Hughes
62e7112b4e trivial: Ensure config.h is included in all source files 2019-11-01 13:56:26 +00:00
Richard Hughes
f4998a7636 trivial: Fix up some NULL/FALSE confusion 2019-11-01 13:55:32 +00:00
Richard Hughes
bf00080d3f Move the file descriptor lifecycle into FuUdevDevice
This also means we can provide common 'safe' versions for plugins to use.
This makes a lot of plugins much simpler and we can delete a lot of code.
2019-10-31 09:21:35 -05:00
Richard Hughes
7f1b8e7dce ebitdo: Modernize the plugin to use FuFirmware
This allows us to do three things:

* Fuzz the loader with `fwupdtool firmware-parse`
* Check the firmware *before* the hardware is put into bootloader mode
* Use FuChunk to build the 32 byte payload chunks
2019-10-31 09:21:35 -05:00
Richard Hughes
2ff3cdca06 nitrokey: Use fu_common_dump_raw() when debugging 2019-10-31 09:21:35 -05:00
Mario Limonciello
7e38dffdcb thunderbolt: Create a unique GUID including Thunderbolt controller path
Systems with multiple host controllers will most likely have a different
NVM image for each controller but there is no guarantee that the device_id
within the NVM image varies from one controller to another.

To account for this, build a GUID that contains the last element of the
Thunderbolt controller's udev path.

Sample GUID strings from an XPS 9380 (which only contains one host controller):
```
  Guid:                 0f401ed2-b847-532a-adc8-3193fc737be6 <- TBT-00d408af-native
  Guid:                 420b0596-f5cb-5fd7-8416-c99d48ad8de9 <- TBT-00d408af-native-0000:05:00.0
```

This commit follows the presumption that the kernel will enumerate the controllers
in the same order every time.
2019-10-30 14:19:36 -05:00
Richard Hughes
6bbc4c787b jabra: Move the Jabra-specific detach out into its own plugin
This also lets us remove the call to dfu_device_wait_for_replug() which was
causing a deadlock due to unsafe main context usage. Splitting the code allows
us to use the device list to watch for replug, without adding even more Jabra-
specific plugin code to the DFU plugin.

Looking at this with a 40,000ft view, the Jabra runtime really doesn't have
much in common with DFU and the reason it was originally all lumped together
was that the daemon couldn't "change" plugins between detach and update.

It's unfortunate that we have to include a sleep() in the DFU code after the
DFU probe, but this is specified by Jabra themselves. Attempting to open the
device without waiting reboots the hub back into runtime firmware mode, so we
can't even retry the failing setup action.
2019-10-30 15:09:49 +00:00
Richard Hughes
f04be98153 vli-usbhub: Add support for updating V2 devices 2019-10-30 09:41:32 -05:00
Richard Hughes
51a869a01d Use XMLb to query quirks
During startup we do 1898 persistent allocations to load the quirk files, which
equates to ~90kb of RSS. Use libxmlb to create a mmap'able store we can query
with XPath queries at runtime.
2019-10-30 08:29:58 -05:00
Richard Hughes
480b386512 synaptics-prometheus: Don't add a config-subdevice in bootloader mode
We can't use the IOTA mechanism in bootloader mode, and failing to create the
FuSynapromDevice object means we can't recover the hardware if the flash failed.
2019-10-30 06:44:14 -05:00
Richard Hughes
b9f812750f dfu: Use the VID/PID to identify devices without download capability in runtime
The name is not always going to identify the device.
2019-10-30 10:32:15 +00:00
Mario Limonciello
d2701b12b2 ebitdo: Add SN30Pro+ to recognized quirk list (Fixes: #1503) 2019-10-28 11:31:32 +00:00
Richard Hughes
83e49ddf4a dfu: Add several quirks for Realtek camera hardware 2019-10-28 08:39:47 +00:00
Richard Hughes
d0b821f832 dfu: Always mark devices as UPDATABLE
Some devices don't set the CAN_DOWNLOAD attribute in their runtime descriptor.

Rather than quirk these devices just assume that all DFU devices with a DFU
interface can download in DFU mode. The logic being, why would they expose a
runtime DFU interface if they can't download new firmware in DFU mode...

Devices like the DW1820A that are currently blacklisted because of broken DFU
support will remain blocked with this change.
2019-10-28 08:39:47 +00:00
Mario Limonciello
e7b2ea02b9 uefi: use genpeimg to mark ASLR and DP/NX on EFI binary
If the tool is available at build time use it to this.
2019-10-26 12:59:11 -05:00
Mario Limonciello
7474976481 trivial: solokey: correct a typo 2019-10-25 09:20:41 -05:00
Mario Limonciello
44b9e46d37 uefi: rework ESP path detection and lifecycle
This makes the daemon less destructive at startup, especially if the ESP
is not mounted.

It's stored in 3 different places right now, so move it into one point of truth.

Now the ESP is detected when needed including all point of time safety checks and
dynamically mounted and unmounted if necessary.
2019-10-24 15:22:01 -05:00
Mario Limonciello
9160fd4dd1 trivial: uefi: show more metadata in to_string method 2019-10-24 15:22:01 -05:00
Richard Hughes
679d1c0f9a Add a plugin to update VIA USB hub hardware
Only protocol V1 hardware (VL810~VL813) is currently supported.
2019-10-24 12:52:18 +01:00
Richard Hughes
4b40590460 solokey: Allow parsing firmware with fwupdtool 2019-10-22 18:38:36 +01:00
Richard Hughes
95c98a95b6 Allow fwupdtool to dump details of common firmware formats
To do this, the plugins have to register the GType(s) they are using for
firmware, along with a short 'id' that can be used in CLI scripts.
2019-10-22 12:36:15 -05:00
Mario Limonciello
66dd3a02cb trivial: dell: work around a memory leak caught by address sanitizer
It appears to only happen on non-dell systems trying to look up system
ID through `sysinfo_get_dell_system_id`

Other than CI non-dell systems won't be running this code.
2019-10-18 22:07:49 -05:00
Mario Limonciello
cbbde24e38 ebitdo: if the device has the will disappear flag, don't wait for ack (Fixes: #994)
Some 8bitdo receivers seem to automatically reboot when done writing,
so just stop if we have that flag and notice this behavior.
2019-10-18 14:47:14 -05:00
Mario Limonciello
eb5d7a4659 Add a new plugin for working with eMMC devices (Fixes: #1455) 2019-10-18 14:18:09 -05:00
Mario Limonciello
3d65399626 trivial: coreboot: fix a clang compiler error
```
../plugins/coreboot/fu-plugin-coreboot.c:96:7: error: assigning to 'gchar *' (aka 'char *') from 'const gchar *' (aka 'const char *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]

        name = fu_plugin_coreboot_get_name_for_type (plugin, NULL);

             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../plugins/coreboot/fu-plugin-coreboot.c:98:8: error: assigning to 'gchar *' (aka 'char *') from 'const gchar *' (aka 'const char *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]

                name = fu_plugin_get_dmi_value (plugin, FU_HWIDS_KEY_PRODUCT_NAME);
```
2019-10-18 10:22:21 +01:00
Mario Limonciello
97c1e727c4 Add new device flags indicating update resilience
fwupd clients will ideally use this information as part of a policy to schedule
updates in the background without user interactions on safe devices.
2019-10-17 11:38:46 -05:00
Patrick Rudolph
0b7143da66 plugins: Add coreboot plugin
Detect and parse current coreboot version.
There's no need to depend on libflashrom for now.

An update mechanism isn't implemented as the kernel interface isn't
stable yet and will be implemented in a separate commit.

Tested on coreboot enabled machine.
Example output:
coreboot System Firmware
  DeviceId:             81104bde9db7cb037936659ea727c739f47a5029
  Guid:                 230c8b18-8d9b-53ec-838b-6cfc0383493a <- main-system-firmware
  Guid:                 de6fd40f-4ec9-5c0b-95e1-8fb13d1b030c <- LENOVO&ThinkPad T410&2537VG5
  Guid:                 978b0d18-bfe9-5279-9a9f-68dc247a705f <- LENOVO&ThinkPad T410&LENOVO&2537VG5
  Summary:              Open Source system boot firmware
  Plugin:               coreboot
  Flags:                internal|registered
  Vendor:               LENOVO
  Version:              4.10.991
  VersionFormat:        triplet
  Icon:                 computer
  Created:              2019-10-14

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
2019-10-17 18:31:01 +02:00
Richard Hughes
9e4bf87184 dfu: Implement FuDevice->to_string() 2019-10-17 14:06:27 +01:00
Mario Limonciello
dc01c717ed trivial: colorhug: fix a crash that occurs when flashing sometimes
If calling `ch_strerror` with some values returns `NULL` which makes
the `GError` not get populated.

```
0  0x00007f252d64d3bd in fu_colorhug_device_attach (device=0x560d7b5c4520 [FuColorhugDevice], error=0x7ffc57a51040) at ../plugins/colorhug/fu-colorhug-device.c:200
1  0x0000560d7a398279 in fu_device_attach (self=0x560d7b5c4520 [FuColorhugDevice], error=0x7ffc57a51040) at ../src/fu-device.c:1988
2  0x0000560d7a3a4b6c in fu_plugin_device_attach (self=0x560d7b57e160 [FuPlugin], device=0x560d7b5c4520 [FuColorhugDevice], error=0x7ffc57a51040) at ../src/fu-plugin.c:856
3  0x0000560d7a3a553f in fu_plugin_runner_device_generic
   (self=0x560d7b57e160 [FuPlugin], device=0x560d7b5c4520 [FuColorhugDevice], symbol_name=0x560d7a3d4258 "fu_plugin_update_attach", device_func=0x560d7a3a4ac1 <fu_plugin_device_attach>, error=0x7ffc57a51040) at ../src/fu-plugin.c:1049
4  0x0000560d7a3a618d in fu_plugin_runner_update_attach (self=0x560d7b57e160 [FuPlugin], device=0x560d7b5c4520 [FuColorhugDevice], error=0x7ffc57a51040) at ../src/fu-plugin.c:1333
5  0x0000560d7a3bcc33 in fu_engine_update
    (self=0x560d7b4b9830 [FuEngine], device_id=0x560d7b64f200 "d45c9d222f7eeb3987c6a7674478bc6aec127b3f", blob_fw2=0x560d7b62c0d0, flags=FWUPD_INSTALL_FLAG_NONE, error=0x7ffc57a51150)
    at ../src/fu-engine.c:2001

(gdb) print error_local
$1 = (GError_autoptr) 0x0
```
2019-10-16 14:40:38 -05:00
Mario Limonciello
50202f5a89 thunderbolt: some more clarifications when using ICL
Currently ICL shows up like this:
```
├─Unknown Device:
│     Device ID:           d066959bf1b0da600f4fcaab5aa31cab3ff05eee
│     Summary:             Unmatched performance for high-speed I/O
│     Current version:     71.00
│     Update Error:        Missing non-active nvmem
│     Flags:               internal|require-ac|registered
│     GUID:                e72e778e-94f7-5ed2-b560-1c1262ee217c
```

Which isn't very useful to end users.  Instead show the generic name
`Thunderbolt Controller` which matches the behavior change we've made
in UEFI FW and Touchpad FW items too.

```
├─Thunderbolt Controller:
│     Device ID:           d066959bf1b0da600f4fcaab5aa31cab3ff05eee
│     Summary:             Unmatched performance for high-speed I/O
│     Current version:     71.00
│     Update Error:        Missing non-active nvmem
│     Flags:               internal|require-ac|registered
│     GUID:                e72e778e-94f7-5ed2-b560-1c1262ee217c
```

Also, quite the messages about missing vid/did as these won't exist
on ICL either.
2019-10-16 10:35:04 +02:00
Mario Limonciello
8e987c7737 trivial: synaptics-cxaudio: Add Google Pixel buds
I saw a mention that they're actually CX21986 and had some on hand.
They do enumerate:

```
├─Pixel USB-C earbuds:
│     Device ID:           672c087de09848d9e7ee32aa1dea2fbeb8b81e6b
│     Summary:             CX21986 USB audio device
│     Current version:     71.133.20
│     Bootloader Version:  03.01.00.00
│     Vendor:              Google (USB:0x18D1)
│     Install Duration:    3 seconds
│     Flags:               updatable|registered
│     GUIDs:               d76048a5-ca69-5cb8-ac86-d418d70c5f29
│                          98043a29-72c5-549b-ad23-de4e2db20a14
│                          93279fe8-d478-531b-9637-05d026be3c2e
│                          8b71f776-f6d0-549d-9547-42740b24bbbc
```
2019-10-15 15:16:26 -05:00
Richard Hughes
1db25c9f2c Allow a custom FuFirmwareImage->write() in superclassed objects 2019-10-15 08:10:11 -05:00
Richard Hughes
6b72cfa25a dfu: Remove two completely unused helpers 2019-10-15 13:04:09 +01:00
Richard Hughes
8cc41cfa6f dfu: Make DfuFirmware derive from FuFirmware 2019-10-14 15:24:08 -05:00
Richard Hughes
f7862c0085 dfu: Make DfuImage derive from FuFirmwareImage 2019-10-14 15:24:08 -05:00
Richard Hughes
4fec0302d2 dfu: Remove private headers that do not need to exist
These are a throwback to when we exported the DFU headers.
2019-10-14 15:24:08 -05:00
Mario Limonciello
8fa0b382fa Add new flags can-verify and can-verify-image
These are used to indicate that the device can verify checksums or
can dump an image for checksumming.
2019-10-14 12:41:09 -05:00
Mario Limonciello
36e9292973 trivial: test: add checksums for "stock" 1.2.2
This has been failing the test suite silently:
```
b585990a-003e-5270-89d5-3705a17f9a43	FAILED: failed to verify using test: no checksum for 1.2.2
```
2019-10-14 12:41:09 -05:00
Mario Limonciello
069449e427 trivial: uefi: don't add PCRs with all 0's
I was seeing on a CML laptop with a Nuvoton TPM the following which
is definitely wrong:
```
  Checksum:             SHA1(791183aa2c4993dfaf75e95c91bdad067ac2cce1)
  Checksum:             SHA256(8a0656fe0024cc3300cc4dc8af4fc336112a51013aeb74b21c138ed116bb8691)
  Checksum:             SHA1(000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
```
2019-10-14 08:58:14 -05:00
Richard Hughes
8feba21210 synaptics-cxaudio: Support the ThinkPad USB-C Dock Gen2 2019-10-14 11:28:04 +01:00
Mario Limonciello
f37af548da 8bitdo: use will-disappear flag for sf30/sn30 controllers (Fixes: #783)
These controllers reboot back into Nintendo Switch mode typically
and fwupd will not be able to probe them.
2019-10-12 14:07:34 -05:00
Mario Limonciello
b73d255b13 trivial: ebitdo: don't dump out firmware header unless plugin verbose 2019-10-12 14:07:34 -05:00
Mario Limonciello
cee97bc674 trivial: ebitdo: don't use local errors when writing firmware
Just prefix them instead.
2019-10-12 14:07:34 -05:00
Richard Hughes
efa2803eb4 wacom-emr: Fix a regression for EMR devices
Actually trying to instantiate the object leads to:

    Specified class size for type 'FuWacomEmrDevice' is smaller than the
    parent type's 'FuWacomDevice' class size.

Fixes https://github.com/fwupd/fwupd/issues/1456
2019-10-12 19:25:44 +01:00
Richard Hughes
c0695320c8 Add a generic DFU firmware object for plugins to use 2019-10-11 13:19:46 +01:00