Commit Graph

1633 Commits

Author SHA1 Message Date
Richard Hughes
464eacdc53 libfwupdplugin: Use fu_device_locker_close() 2020-03-26 15:23:10 -05:00
Richard Hughes
d66a445ada synaptics-mst: Use fu_device_locker_close() 2020-03-26 15:23:10 -05:00
Richard Hughes
87d39d06a3 ccgx: Do not store the silicon ID in the image address
First, it's a hack; second we actually need to store the start address for
flashing FW2 on asymmetric hardware...
2020-03-24 21:16:08 +00:00
Richard Hughes
bf5481e358 ccgx: Add device quirks for the Lenovo Hybrid Dock 2020-03-24 21:16:08 +00:00
Richard Hughes
9278e265b4 ccgx: Switch HID mode to HPI mode at startup 2020-03-24 21:16:08 +00:00
Richard Hughes
dab6bda2be ccgx: Clear the event queue when in startup 2020-03-24 21:16:08 +00:00
Richard Hughes
fd7f13f905 ccgx: Wait for hardware to settle when coming out of reset 2020-03-24 21:16:08 +00:00
Richard Hughes
3990a71401 ccgx: Do not mark the device as updatable when in boot mode 2020-03-24 21:16:08 +00:00
Richard Hughes
c6147bf340 ccgx: Verify the firmware app type when preparing firmware 2020-03-24 21:16:08 +00:00
Richard Hughes
754d85e282 ccgx: Set the update message when running in backup firmware 2020-03-24 21:16:08 +00:00
Richard Hughes
de61d27259 ccgx: Read the FwAppType from the hardware 2020-03-24 21:16:08 +00:00
Richard Hughes
2b45362e25 ccgx: Set the HPI version number for the current firmware 2020-03-24 21:16:08 +00:00
Richard Hughes
c6a671be7e ccgx: Get the silicon ID to map the flash parameters 2020-03-24 21:16:08 +00:00
Richard Hughes
11fa0a1e90 ccgx: Read the HPI device mode at startup 2020-03-24 21:16:08 +00:00
Richard Hughes
0a37232ba1 ccgx: Set up the HPI I²C config at startup 2020-03-24 21:16:08 +00: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
cff23f798f trivial: Autodetect the HID interface to use 2020-03-24 08:34:16 -05:00
Richard Hughes
62aa46cb83 ccgx: Create devices when in HID and I2C modes 2020-03-23 20:02:17 +00:00
Richard Hughes
46963b1118 csr: Allow truncated HID reads
The device is allowed to return short buffers during read operation. This fixes
a regression introduced in c04f5a3.

Fixes https://github.com/fwupd/fwupd/issues/1893
2020-03-23 13:40:34 +00:00
Emily
5f3a2c0bc1 vli: Only consider the high nibble when building the sub-version 2020-03-23 08:11:14 +00:00
Richard Hughes
ded9fef4b6 csr: Parse the firmware as a DFU file
This was changed to Intel hex in 7afd7cba0d,
probbaly due to a copy-paste mistake. Change it back to DFU.

Fixes https://github.com/fwupd/fwupd/issues/1890
2020-03-22 11:46:40 -05:00
Richard Hughes
811e75db4b Add support for EP963x hardware 2020-03-22 15:48:04 +00:00
Richard Hughes
c04f5a3e15 Add FuHidDevice abstraction
Quite a few plugins use HID commands to communicate with the hardware. At the
mement we have ~6 implementations of SET_REPORT and are soon to add one more.

Move this into common code.
2020-03-19 17:02:07 +00:00
Richard Hughes
dd34e51711 trivial: Fix up some argument names with additional docs 2020-03-19 06:43:42 +00:00
Richard Hughes
ed07a17509 vli: Correctly attach VL103 after a firmware update
This works around a silicon errata which makes the existing 0xB0 chip reset
non-functional.

ALso, as VL10x and VL103 are so different now, use different `->attach()` and
`->detach()` implementations for code sanity.

Based on a patch by Sherlock Chu <SherlockChu@via-labs.com>, many thanks.
2020-03-19 06:43:42 +00:00
Richard Hughes
ac48c7f45a trivial: Add a GObject property for FuVliDevice::kind 2020-03-19 06:43:42 +00:00
Richard Hughes
48d9fb8f74 ccgx: Parse the metadata block in the firmware image 2020-03-18 18:57:06 +00:00
Richard Hughes
b258e514c5 ccgx: Add a firmare parser for cyacd files
These are visually similar to Intel hex files, but different enough to demand
their own parser. Multiple images can be stored in one firmware file, with the
`addr` set to the SiliconID and the `idx` set to the position in the file.
2020-03-18 18:57:06 +00:00
Mario Limonciello
c0f1f1c7e3 trivial: logitech-hidpp: decrease the verbosity of some debugging 2020-03-17 18:43:08 -05:00
Mario Limonciello
15cb61b34e trivial: logical-hidpp: fix some debugging messages not working 2020-03-17 18:43:08 -05:00
Mario Limonciello
c6ae0d998b logitech: Correctly set the protocol
Fixes updates on signed receivers.
2020-03-17 18:43:08 -05:00
Richard Hughes
252b0c704e vli: Remove a dock device from the whitelist that is never going to be updated
This is an old EOL dock that does not respond well to probing -- leading to an
occasional multi-second startup deadlock on startup.
2020-03-16 11:56:35 +00:00
Richard Hughes
3dadb99c6c vli: Add some trivial debugging to help track down a bug 2020-03-16 11:56:35 +00:00
Richard Hughes
bd5e6f00d2 vli: Never add USB hub devices that are not upgradable
There's almost no point; you can't interact with them in any meaningful way.
2020-03-16 11:56:35 +00:00
Mario Limonciello
7b866e5f92 uefi: Don't use shim for non-secure boot configurations
Since the entry is dynamically created this removes one area that
can potentially cause failures.
Helps: #1794
2020-03-16 06:55:05 -05:00
Richard Hughes
7825ae8dd1 dfu: Actually reload the DFU device after upgrade has completed
The m-stack DFU quirk also requires that we get the runtime status so that the
USB_DFU_SUCCESS_FUNC callback gets called. We were doing this by accident
before, and since switching to the FuDevice subclass this was dropped.

The dfu_device_refresh_and_clear() function is safe to call on a device which
does not have a working runtime interface.
2020-03-12 15:41:14 +00:00
Richard Hughes
fa41739ab0 dfu: Add one more m-stack device requiring a quirk 2020-03-11 16:10:10 +00:00
Richard Hughes
c3afed36d5 Allow waiting for the parent device when replugging
If a child device resets a parent device then we want to wait for the root
device, not the child.
2020-03-10 17:09:13 +00:00
Richard Hughes
4fb8693598 vli: Fix an error when detaching MSP430
The parent has to be opened and we need a longer delay before reading.
2020-03-10 15:12:09 +00:00
Richard Hughes
ff93d91f5a vli: Fix a critical warning when getting the USB speed 2020-03-10 15:09:43 +00:00
Richard Hughes
393b0a1677 vli: Fix the error enum values for the MSP430 2020-03-10 15:09:15 +00:00
Richard Hughes
c6c3d6c4c8 vli: Fix the version calculation for MSP430
Nobody from USI reviewed this, so it was wrong.
2020-03-10 15:07:17 +00:00
Richard Hughes
75b7d79424 vli: Fix compile warning introduced in 75cc9161c5 2020-03-10 12:16:09 +00:00
Richard Hughes
f4f4ebe0a2 vli: Ignore one more error when attaching 2020-03-10 12:11:19 +00:00
Richard Hughes
75cc9161c5 vli: Always expect the VL103 header at 0x1003 or 0x4000
I misunderstood the original specification, and it seems even USB-hub-less
devices have the same header location as their "write-through" counterparts.
2020-03-10 12:09:27 +00:00
Richard Hughes
640dbbb0f0 vli: Do not fall back to the recovery write for usbhubs
The checksum check was only being calculated on the size of the pointer, rather
than the size of the struct.
2020-03-10 12:07:28 +00:00
Richard Hughes
09e8e5e7ef vli: Only show the 2nd header if the device ID is valid
Otherwise we get a scary warning about the CRC not being valid, when the block
is just empty.
2020-03-10 12:06:12 +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
df2ae010d5 vli: Add some better comments for writing GPIOs 2020-03-10 10:42:52 +00:00
Richard Hughes
7fe2e48d7b trivial: Remove now-unused functionality in dfu-tool 2020-03-09 21:12:01 +00:00
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