Commit Graph

1633 Commits

Author SHA1 Message Date
Richard Hughes
c1eda7d516 Add many new plugins to support for the Host Security ID
The HSI specification is currently incomplete and in active development.

Sample output for my Lenovo P50 Laptop:

    Host Security ID: HSI:2+UA!

    HSI-1
    ✔  UEFI dbx: OK
    ✔  TPM: v2.0
    ✔  SPI: Write disabled
    ✔  SPI: Lock enabled
    ✔  SPI: SMM required
    ✔  UEFI Secure Boot: Enabled

    HSI-2
    ✔  TPM Reconstruction: Matched PCR0 reading

    HSI-3
    ✘  Linux Kernel S3 Sleep: Deep sleep available

    HSI-4
    ✘  Intel CET: Unavailable

    Runtime Suffix -U
    ✔  Firmware Updates: Newest release is 8 months old

    Runtime Suffix -A
    ✔  Firmware Attestation: OK

    Runtime Suffix -!
    ✔  fwupd plugins: OK
    ✔  Linux Kernel: OK
    ✔  Linux Kernel: Locked down
    ✘  Linux Swap: Not encrypted
2020-05-12 21:20:18 +01:00
Richard Hughes
f58ac7316c hsi: Abstract out the list of FwupdSecurityAttr objects for plugins
This exports FuSecurityAttrs into libfwupdplugin so that we can pass the plugins
this object rather than a 'bare' GPtrArray. This greatly simplifies the object
ownership, and also allows us to check the object type before adding.

In the future we could also check for duplicate appstream IDs or missing
properties at insertion time.

This change also changes the fu_plugin_add_security_attrs() to not return an
error. This forces the plugin to handle the error, storing the failure in the
attribute itself.

Only the plugin know if a missing file it needs to read indicates a runtime
problem or a simple failure to obtain a specific HSI level.
2020-05-12 16:47:24 +01:00
Richard Hughes
99cc658a75 tpm-eventlog: Add an HSI attr for reconstruction failure 2020-05-12 12:29:42 +01:00
Subhendu Ghosh
d1d83c083e ata: Add OUI quirk for Western Digital 2020-05-11 08:15:43 +01:00
Ilya Guterman
46f5415eda dfu: Support MATEKF722SE quirk
MATEKF722SE has unconvetional behavior for dfu protocol, where the sector size
isn't specified and sector type is shiffted left by 1. This happens only for
one sector.

Sector parsing from MATEKF722SE:

 * `016Kg`
 * `64Kg`
 * `128Kg`
 * `048 e`
 * `528e`
 * `004 e`
2020-05-09 20:19:57 +01:00
Mario Limonciello
cb6ec2b18e trivial: uefi-dbx: correct error message on missing file
```
unset error in plugin uefi_dbx for add_security_attrs()
```
2020-05-07 13:02:57 -05:00
Richard Hughes
b9640a28ec uefi-dbx: Add a plugin that analyses the UEFI dbx variable
This will be used for future functionality.
2020-05-07 16:59:36 +01:00
Richard Hughes
9ed79ae644 Fix various build issues with -Wdiscarded-qualifiers
Fixes https://github.com/fwupd/fwupd/issues/2068
2020-05-07 16:15:30 +01:00
Richard Hughes
d744fe8b67 linux-swap: Rename the plugin as it is Linux specific
We'll be adding other linux-foo plugins in the future, so it makes sense to get
the namespace correct now.
2020-05-07 12:42:34 +01:00
Mario Limonciello
768a2680a6 Introduce a new flag skips-restart
This flag is used internally by plugins to indicate that they will
skip the phase of firmware installation that power cycles a device.

It is intended to be set by quirks or other environment settings.
2020-05-06 15:13:40 -05:00
Richard Hughes
2d6456e019 cpu: Parse the CPU flags to detect the CET status
New enough hardware to have this feature isn't going to be in the marketplace
for a while. To use that newer hardware requires a very recent kernel (5.6 at
least, although it will probably be at least 5.9 by the time the hardware is
released).

The CET status will be used in future functionality.
2020-05-06 18:15:28 +01:00
Mario Limonciello
0cd2f10711 trivial: dell-dock: delay activation of the thunderbolt updates
There was some regression between 1.4.0 and now that prevented updates
containing a Thunderbolt controller from finishing.  They would just
sit pending Thunderbolt replug without ever finishing.

Remove the old hack for replug and instead push activation to the end
of the composite steps.

This is to avoid the device tree from changing significantly during
the update process.

This still isn't really ideal, we want to be able to add the flag
usable-during-update to the thunderbolt controller, but this requires
some extra work in the kernel.
2020-05-06 11:13:51 -05:00
Mario Limonciello
94874cd067 thunderbolt: Add a new subclassed thunderbolt firmware update type
Thunderbolt images brought in from the SPI don't have a FARB header.
Thunderbolt update images do.

So these two types of images need to be handled separately from the
firmware parser.
2020-05-06 11:13:51 -05:00
Richard Hughes
c368958518 swap: Add a plugin that parses /proc/swaps
This will be used for future functionality.
2020-05-06 15:09:59 +01:00
Jakob
f4b843db43 Add OUI quirk for SanDisk 2020-05-02 08:51:53 +01:00
Richard Hughes
0258c12af3 uefi: Manually call fu_device_setup() during coldplug
This forces the daemon to convert the main-system-firmware instance ID to a
GUID, which allows us to find it using fu_device_list_get_by_guid()
2020-05-01 19:26:52 +01:00
Richard Hughes
af917f558b vli: Add two standard USB instance IDs for shared-PD devices 2020-04-30 11:06:28 +01:00
Richard Hughes
cbc65bc071 vli: Use GPIOB to reset the VL817 found in two Lenovo products 2020-04-30 11:06:28 +01:00
Mario Limonciello
825c04df73 trivial: tpm-eventlog: Modify -p argument behavior
If using this argument, only display the final calculated value.
2020-04-29 13:18:53 -05:00
Mario Limonciello
38c80baff5 tpm-eventlog: Disambiguate the output at the end of fwupdtpmevlog
It's not obvious to users if this is the same value as tpm2-tools or the reconstructed value.
2020-04-29 13:18:53 -05:00
Mario Limonciello
e1c8c018a5 tpm-eventlog: Correct the display of final calculated PCRs
Although the calculation matched on my machine the actual numbers didn't
match PCR0 values from the tpm2-tools.  This was a display error.
2020-04-29 13:18:53 -05:00
Mario Limonciello
16a96fbbe7 thunderbolt: Allow quirks to skip the authentication step
This will allow being able to PoC some future kernel work to split
up steps.
2020-04-29 13:15:45 -05:00
Mario Limonciello
6358e23490 thunderbolt: drop support for force power
The kernel interface for force power doesn't support tracking the state
of the device, and so this had to be tracked by fwupd.

Unfortunately due to system and thunderbolt controller firmware behavior
on some systems the thunderbolt controller /still/ didn't return even
when force power state was accurately tracked.

The device model for the uevent related to the device removal being ignored
doesn't really fit into the current fwupd architecture anymore either.

Lastly this is a very legacy feature at this point.  Thunderbolt3 controllers
distributed in the last 3 years all operate in 'native' mode meaning that
they will always be powered and use runtime power management.

USB4 controllers won't have a concept of being force powered.
USB4 reimers will have this concept, but the state will be tracked by the
kernel and obfuscated from userspace.

So with all that said, tear out all of the force power related code.
2020-04-29 13:15:45 -05:00
Mario Limonciello
ec44dd3353 Modernize the thunderbolt plugin.
Remove it's references to it's own GUdevclient and instead use
FuUdevDevice.

Some intentional casualties of the move:
* Plugin metadata around native and safe mode dropped.
  - These haven't been useful in debugging anything and aren't relevant
    on new hardware
* Extra GUID for 2 host controllers in same system dropped
  - Although this was normally static information BIOS operations like
    turning off PCI-E SD card reader or LAN controller changed things.
* The NVM version is parsed directly instead of through gudev to prevent
  cached data breaking change events.

Remaining TODO:
* Force power w/ thunderbolt-power doesn't work
2020-04-29 13:15:45 -05:00
Mario Limonciello
767c29e2cc trivial: make building plugins without gudev more obvious failures 2020-04-29 13:15:45 -05:00
Crag Wang
e010c606e4 wacom-raw: fixup switching to bootloader mode 2020-04-28 10:19:38 -05:00
Richard Hughes
02930f1f23 trivial: Fix DFU debug output 2020-04-28 13:38:48 +01:00
Richard Hughes
4eaf882911 trivial: Fix a potential NULL deref spotted by Coverity 2020-04-27 16:12:55 +01:00
Mario Limonciello
55a42ddcbb thunderbolt: Don't show safe mode errors for USB4 host controllers
USB4 Controllers were showing up like this:

USB4 Controller:
     Device ID:           3df660bc4bdb67fd6fc101b34c6fd8cd235e3f97
     Summary:             Unmatched performance for high-speed I/O
     Current version:     00.00
     Update Error:        Device is in safe mode
     GUID:                4d86f168-e1cc-5995-afd3-ae9df6a14f5e -> TBT-safemode
     Device Flags:         Internal device
                           Requires AC power
2020-04-23 14:13:38 -05:00
jf049
f0a3bf0436 trivial: Add OUI quirk for ADATA 2020-04-23 06:47:19 +01:00
Daniel Peukert
3cebd5aa89 trivial: Add OUI quirk for LITE-ON 2020-04-22 12:43:39 -05:00
Daniel Peukert
8a4b32f699 trivial: Reorder OUI quirks by OUI ID 2020-04-22 12:43:39 -05:00
Richard Hughes
c92a2caf16 ep963x: Various changes to make the plugin actually work on real hardware 2020-04-22 12:27:44 +01:00
Richard Hughes
0d4e2ca4c5 Make tss2-esys conditional
This is not provided in RHEL 8 in the default build root.
2020-04-22 09:36:14 +01:00
Richard Hughes
7b0023de7f ep963x: Remove some dead code spotted by Coverity 2020-04-21 16:45:31 +01:00
Richard Hughes
b74db0618c ccgx: Only update the FW2 partition of the ThinkPad USB-C Dock Gen2 2020-04-21 14:34:03 +01:00
Richard Hughes
6adbcd2e62 ccgx: Expand the FWImageType for future hardware
This is needed to handle devices that do need the bootloader updated before the
actual firmware image.
2020-04-21 14:34:03 +01:00
Richard Hughes
53e22ed0c1 wacom-usb: Fix a theoretical buffer over-read to make GCC happy 2020-04-20 15:50:10 +01:00
Richard Hughes
36f3218da9 vli: Only show the i2c devices on the USB3 hub
If the hub is running in degraded USB2 recovery mode do not enumerate the
easy-to-brick MSP430 device.
2020-04-18 14:52:50 +01:00
Richard Hughes
ec279f161c ccgx: Always report 100% when finished writing 2020-04-17 21:49:15 +01:00
Richard Hughes
da645fe912 ccgx: Set the device name and summary from quirk files
Based on a patch by Ryan Lee <ryle@cypress.com>, many thanks.
2020-04-17 21:48:02 +01:00
Richard Hughes
cacf14e54f trivial: Add OUI quirk for Toshiba 2020-04-17 18:48:35 +01:00
Richard Hughes
518712ac09 vli: Only do the APP5 FW bug fix on affected hardware 2020-04-17 16:09:32 +01:00
Richard Hughes
5997f2a7da vli: Show all the buffer when debugging with FWUPD_VLI_USBHUB_VERBOSE 2020-04-17 14:15:50 +01:00
Richard Hughes
08d5caa758 ccgx: Split out a trivial helper to set the instance IDs
As a consequence, the version number is also set in the event that the silicon
or firmware app-id is not set, which also seems like the right thing to do.
2020-04-16 15:52:55 +01:00
Richard Hughes
919d90e941 ccgx: Set the device name to be more useful
Based on a patch by Ryan Lee <ryle@cypress.com>, many thanks.
2020-04-16 15:52:55 +01:00
Richard Hughes
e419792c61 ccgx: Set the logical ID as the FwMode 2020-04-16 15:52:55 +01:00
Richard Hughes
d41e8254ca ccgx: Split out a trivial function to set the version 2020-04-16 15:52:55 +01:00
Richard Hughes
71f5eaa371 ccgx: Do not reboot the device write after installing
Since a8c6c0 we do not conditionalize the attach on the BOOTLOADER flag, and so
attach gets run once manually, and then again automatically.
2020-04-16 15:52:55 +01:00
Richard Hughes
54e3feae12 ccgx: Do no show the flash parameters when unknown 2020-04-16 15:52:55 +01:00
Richard Hughes
1283c2696d Do not skip attach() if the device is marked _WILL_DISAPPEAR
The idea here is that the device would not come back after it was restarted,
and skipping the attach in the engine was only working around the fact that the
ebitdo did not split out an ->attach() function.

We can't really blame it; we only decoupled the _IS_BOOTLOADER requirement
for ->attach() recently...
2020-04-16 08:43:45 -05:00
Richard Hughes
a1ef52e5f9 dell-dock: Port to using fu_device_get_proxy()
This also cleans up the memory handling to prevent a ref-cycle loop that
prevented the dock devices from being finalized if the dock was removed.
2020-04-15 20:34:31 +01:00
Richard Hughes
e95613f670 vli: Do not show the USB 2 recovery devices for USB 3 hubs
The USB 2.0 controller is used as a 'backup' in case the USB 3.0 firmware fails
to start. Set USB 3 hubs as a greater priority so that the USB 2 ones do not
not get added if the USB 3 firmware is working.
2020-04-15 14:11:06 +01:00
Richard Hughes
95c3bf2617 vli: Add metadata to identify which is the same physical device 2020-04-15 14:11:06 +01:00
Sam Morris
6a161aa1d1 uefi: correctly format firmware version of Dynabook (né Toshiba) X30, X40 and probably others
Fixes #1998
2020-04-15 13:00:26 +01:00
Richard Hughes
a86b08f27c synaptics-cxaudio: Use the ->attach() device vfunc
This allows us to test the device reset using fwupdtool.
2020-04-15 12:36:11 +01:00
Richard Hughes
f23a906cfb synaptics-cxaudio: Wait for the device to reboot after writing firmware
Fixes an error where we get:

    failed to reload device: USB error on device 17ef:a396 : No such device
2020-04-15 12:36:11 +01:00
Mario Limonciello
de60e04481 logitech_hidpp: decrease verbosity of messages that hid++ ID is missing
These are a regression of 9e755e2a5 when devices are asleep.
However due to the current kernel and daemon architecture, logitech devices
are not checked again at any time so if the device isn't awake when
fwupd is started or the unifying dongle is plugged in it won't be present.

This will be changed in the future when the kernel has change events
associated with devices waking up.

Fixes: #1973
2020-04-14 11:26:22 -05:00
Richard Hughes
cf0a7678b8 Allow removing device flags from quirk files
This also means we do the right thing when plugins call fu_device_add_flag()
directly, instead of just from a quirk file.

For instance, now `Flags = ~updatable` is a valid and useful thing to have and
allows us to remove the `Flags = None` hack.
2020-04-13 23:18:19 +01:00
Richard Hughes
fe11927eef Use black to format python source in a consistent manner
No code changes.
2020-04-13 23:06:30 +01:00
Richard Hughes
a8c6c02459 Do not conditionalize attach() and detach() on IS_BOOTLOADER
This is nice in theory, until you need to look at the bootloader status of the
parent, or of a different device entirely. Handle this in plugins for the few
cases we care about and stop setting or clearing IS_BOOTLOADER manually just to
get the vfuncs to be run.

Note: I do not think we want to use cleanup() for attaching devices not in
bootloader states -- as cleanup is only run at the end of the composite update.
2020-04-09 09:55:30 +01:00
Richard Hughes
508fb380d0 wacom-usb: Add more sanity checks in case the daemon goes crazy 2020-04-08 16:30:15 +01:00
Richard Hughes
385b3b29b4 wacom-usb: Use a per-device cleanup function
We never had this when the plugin was created and it makes bluetooth updates
without main firmware updates reboot the device correctly.
2020-04-08 16:30:15 +01:00
Richard Hughes
3fc550e9ed wacom-usb: Add a lot of missing metadata about the devices 2020-04-08 13:55:39 +01:00
Richard Hughes
46eefe72c1 wacom-usb: Hide a lot of debugging behind FWUPD_WACOM_VERBOSE 2020-04-08 13:55:39 +01:00
Richard Hughes
cddf5b5b89 Only auto-add counterpart GUIDs when required
Doing this unconditionally means we accidentally 'bleed' one device mode into
another in a non-obvious way. For instance, a device might have two operating
modes with different GUIDs. If firmware is supplied for both modes in the same
cabinet archive then we might accidentally match the 'wrong' firmware when
the daemon has observed a mode switch and added the counterpart GUIDs.

We only really need the counterpart GUIDs when switching between Jabra, 8bitdo
and DFU devices where the DFU bootloader VID:PID is not manually tagged with
`CounterpartGuid` in a quirk file. In the general case lets keep it simple to
avoid difficult to find bugs.
2020-04-08 13:55:39 +01:00
Ryan Lee
ac58360be7 ccgx: remove update message 2020-04-08 13:27:37 +01:00
Ryan Lee
d3fe478168 ccgx: add parent guid for hybrid dock 2020-04-08 09:09:54 +01:00
Richard Hughes
d38baba712 ccgx: Use a smaller timeout for i2c read and write operations 2020-04-07 19:50:43 +01:00
Richard Hughes
ebaa488b64 ccgx: Retry the register read and write with a i2c reset
Based on a patch by Ryan Lee <ryle@cypress.com>, many thanks.
2020-04-07 19:50:43 +01:00
Richard Hughes
2e0954f5c9 ccgx: Fix buffer overflow when reading out i2c status
Based on a patch by Ryan Lee <ryle@cypress.com>, many thanks.
2020-04-07 19:50:43 +01:00
Richard Hughes
1ae10f1016 Revert "ccgx: Reset the i2c bridge on status failure"
This reverts commit 49797d7de4.
2020-04-07 19:50:43 +01:00
Richard Hughes
5a7095dee4 ccgx: Retry the HID disconnect up to 5 times
Based on a patch by  Ryan Lee <ryle@cypress.com>, many thanks.
2020-04-07 19:50:43 +01:00
Richard Hughes
920713245d ccgx: Show a better error message on failure 2020-04-07 12:50:28 -05:00
Richard Hughes
481b01046b ccgx: Allow forcing firmware of the wrong app_type with fwupdtool
If we corrupt the flash, the app_type is 0x0 and we need to force this with a
known-good image to recover the hardware. Ask me how I know.
2020-04-07 18:43:31 +01:00
Ryan Lee
b9fecc4b9c ccgx: Fix critical warning on i2c write failure 2020-04-07 10:47:01 +01:00
Richard Hughes
9e755e2a5c logitech-hidpp: Do not add peripheral devices for receiver in BL mode
This should fix flashing firmware when there are >= 2 receivers plugged in.

Fixes https://github.com/fwupd/fwupd/issues/1951
2020-04-06 14:20:46 -05:00
Richard Hughes
ca03290a12 vli: Only reboot the USB hub once
The cleanup action for the FuVliUsbhubPdDevice is correct, but was not
conditionalized in the composite cleanup, which meant we would reboot twice
for a normal USB hub update.

Move the parent reboot into the right place, although this does mean we might
reboot twice in the rare event of scheduing a FuVliUsbhubPdDevice *and*
FuVliUsbhubDevice update in the same transaction -- but resetting the device
state between updates is arguably correct anyway...
2020-04-02 13:23:40 +01:00
Richard Hughes
2671aaceb2 synaptics-cxaudio: Only use the PATCH2 address when the patch level is 2 2020-04-02 13:23:16 +01:00
Ilya Guterman
257df03f58 add STM32F745 stm dfuse quirk 2020-04-02 13:22:53 +01:00
Richard Hughes
5af1dc69d4 dfu: Add a way to set the timeout from a quirk 2020-04-02 13:22:28 +01:00
Richard Hughes
b951a18fae ccgx: Do not add the HID device that will disconnect 2020-04-01 10:38:50 +01:00
ChangHee (Ryan) Lee
60103e2207 ccgx: Use Silicon ID and Application type to set flash parameters
Also remove unused instance id and fix application type matching as we now get
the image type from the quirk file.
2020-04-01 10:38:50 +01:00
Mario Limonciello
61f74077ed trivial: dfu: drop quirk to hide DW1820A
This can't actually damage the device, it was just showing the wrong flags.
The device is also EOL, so it won't even be seen on most modern machines.
2020-03-31 13:05:57 -05:00
Mario Limonciello
80d9b7450c logitech_hidpp: set the bootloader protocol 2020-03-31 13:05:42 -05:00
Richard Hughes
6fa43550fc vli: Wait for the VL103 to timeout to fix detach
The default re-enumeration delay is not sufficient.
2020-03-31 09:34:15 +01:00
Richard Hughes
61d9449d31 ccgx: Show the UpdateMessage in the correct device mode 2020-03-31 08:59:27 +01:00
Richard Hughes
be12af78f0 ccgx: Add extra instance IDs to match specific firmware
The VID:PID of the device in HPI mode is shared between multiple vendors, and
so we need to use both the silicon ID and the application ID to match specific
firmware updates.
2020-03-31 08:59:27 +01:00
Mario Limonciello
97acc2bf74 thunderbolt: Rather than hardcoding to PCI slot numbers, use domain in GUID
This allows the PCI topology to change, but assumes that thunderbolt host controllers
are enumerated in the same order every time.
It won't matter if the first controller jumped from bus 5 to 7 and consequently the
second from 65 to 71, but rather that the first was enumerated followed by the second.
2020-03-28 09:52:38 -05:00
Mario Limonciello
e6d76a594c Revert "thunderbolt: Create a unique GUID including Thunderbolt controller path"
This reverts commit 7e38dffdcb.
2020-03-28 09:52:38 -05:00
Richard Hughes
eb326f7546 dell-dock: Port to fu_device_retry() 2020-03-28 12:46:03 +00:00
Richard Hughes
461149e636 nitrokey: Convert to use FuHidDevice 2020-03-28 12:46:03 +00:00
Richard Hughes
355d5d545d nitrokey: Port to fu_device_retry() 2020-03-28 12:46:03 +00:00
Richard Hughes
a3740518b2 vli: Port to fu_device_retry() 2020-03-28 12:46:03 +00:00
Richard Hughes
49797d7de4 ccgx: Reset the i2c bridge on status failure 2020-03-28 12:46:03 +00:00
Richard Hughes
8e86b1ec4c trivial: Fix the ThinkPad USB-C Dock Gen2 audio device parent 2020-03-27 14:25:17 +00:00
Richard Hughes
5d787b5958 trivial: Set up the parent GUIDs for the Lenovo Gen2 Dock 2020-03-27 13:57:09 +00:00
Richard Hughes
81da69e73d ccgx: Implement writing firmware to flash
Correctly attach into the alternate mode after the update has completed.

The vendor was appending two files to make LVFS distribution 'easier' but I'd
much rather use the same deliverables as Windows. This also allows us to
simplify the firmware loading.
2020-03-27 13:25:40 +00:00
Changhee (Ryan) Lee
338f5a4083 ccgx: Add i2c status check when reading or writing registers
Signed-off-by: Richard Hughes <richard@hughsie.com>
2020-03-27 13:25:40 +00:00
Changhee (Ryan) Lee
064c5cce19 ccgx: Add 5ms delay between read registers to avoid an i2c error
Signed-off-by: Richard Hughes <richard@hughsie.com>
2020-03-27 13:25:40 +00:00