Commit Graph

115 Commits

Author SHA1 Message Date
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
Richard Hughes
731875af86 Remove FU_PLUGIN_RULE_REQUIRES_QUIRK as all the plugins now use it 2019-10-09 20:02:16 +01:00
Mario Limonciello
a1f9d5850b trivial: uefi, dell: skip self tests with TPM if non-root (Fixes: #1396)
There are some packaging problems in some distributions that lead
to TSS stack emitting warnings that will fail self tests.

These don't occur as root, and furthermore those distributions run
CI as root already.

And in the dell plugin make it non-fatal to have TPM register read failures
in case the system has TPM1.2 not TPM2.0
2019-09-25 08:38:04 -05:00
Mario Limonciello
4e343bc1b9 trivial: dell: quiet the TSS output
This is the same as commit 5206592347
2019-09-25 08:38:04 -05:00
Mario Limonciello
20cc9eebc5 Try to only show DMI product name once
* libfwupd: export new property HostProduct
* clients: Use this property for setting the title of trees

Before:
```
○
├─XPS 13 7390 TPM 2.0:
│     Device ID:           c56e9f77cfee65151bdef90310776f9d62827f5a
│     Summary:             Platform TPM device
│     Current version:     7.2.1.0
│     Vendor:              Dell Inc.
│     Update Error:        Updating disabled due to TPM ownership
│     Flags:               internal|require-ac|registered
└─XPS 13 7390 System Firmware:
      Device ID:           b6c08fb9e5384d9d101853cc1ca20cf0ce2df2e2
      Current version:     0.1.1.1
      Minimum Version:     0.1.1.1
      Vendor:              Dell Inc.
      Flags:               internal|updatable|require-ac|registered|needs-reboot

```

After:
```
XPS 13 7390
│
├─TPM 2.0:
│     Device ID:           c56e9f77cfee65151bdef90310776f9d62827f5a
│     Summary:             Platform TPM device
│     Current version:     7.2.1.0
│     Vendor:              Dell Inc.
│     Update Error:        Updating disabled due to TPM ownership
│     Flags:               internal|require-ac|registered
└─System Firmware:
      Device ID:           b6c08fb9e5384d9d101853cc1ca20cf0ce2df2e2
      Current version:     0.1.1.1
      Minimum Version:     0.1.1.1
      Vendor:              Dell Inc.
      Flags:               internal|updatable|require-ac|registered|needs-reboot
```
2019-09-05 11:22:39 -05:00
Mario Limonciello
2275379196 dell: Use TSS to query and build TPM vendor strings for GUIDs
These are a more scalable way to apply firmware across a variety of
platforms.

An example:
```
XPS 13 7390 TPM 2.0
  DeviceId:             c56e9f77cfee65151bdef90310776f9d62827f5a
  Guid:                 a4352c96-f8d7-526c-8485-7f84085f348e <- 0962-2.0
  Guid:                 7d65b10b-bb24-552d-ade5-590b3b278188 <- DELL-TPM-2.0-NTC-NPCT
  Guid:                 6f5ddd3a-8339-5b2a-b9a6-cf3b92f6c86d <- DELL-TPM-2.0-NTC-NPCT75x
  Guid:                 fe462d4a-e48f-5069-9172-47330fc5e838 <- DELL-TPM-2.0-NTC-NPCT75xrls
  Summary:              Platform TPM device
  Plugin:               uefi
  Flags:                internal|require-ac|registered
  Vendor:               Dell Inc.
  Version:              7.2.1.0
  VersionFormat:        quad
  Icon:                 computer
  Created:              2019-09-04
```

When this system is queried using tpm2-tools:
```
$ sudo tpm2_getcap -c properties-fixed
TPM_PT_FAMILY_INDICATOR:
  as UINT32:                0x08322e3000
  as string:                "2.0"
TPM_PT_LEVEL:               0
TPM_PT_REVISION:            1.38
TPM_PT_DAY_OF_YEAR:         0x00000008
TPM_PT_YEAR:                0x000007e2
TPM_PT_MANUFACTURER:        0x4e544300
TPM_PT_VENDOR_STRING_1:
  as UINT32:                0x4e504354
  as string:                "NPCT"
TPM_PT_VENDOR_STRING_2:
  as UINT32:                0x37357800
  as string:                "75x"
TPM_PT_VENDOR_STRING_3:
  as UINT32:                0x02010024
  as string:                ""
TPM_PT_VENDOR_STRING_4:
  as UINT32:                0x726c7300
  as string:                "rls"
```
2019-09-05 00:23:23 -05:00
Mario Limonciello
43742bcd3b trivial: dell: show reasons for lack of updates in UpdateError
```
└─XPS 13 7390 TPM 2.0:
      Device ID:           c56e9f77cfee65151bdef90310776f9d62827f5a
      Summary:             Platform TPM device
      Current version:     7.2.1.0
      Vendor:              Dell Inc.
      Update Error:        Updating disabled due to TPM owernship
      Flags:               internal|require-ac|registered
```
2019-09-05 00:23:23 -05:00
Richard Hughes
d350b2ecd7 synapticsmst: Partially rewrite the plugin (Fixes #1105)
This removes the 'two-layer' FuDevice and FuSyanpticsmstDevice model, where
a complicated plugin cache was used to add and remove devices to the daemon.

By making FuSynapticsmstDevice derive from FuDevice rather than GObject we can
also use a lot of the helper functionality like the other plugins, for instance
->prepare_firmware().

The `drm_dp_aux_dev` devices do not emit uevents on unplug/re-plug and so all
devices of `drm` class are watched and the actual DP AUX devices rescanned after
a small delay. When the AUX devices emit changes from the kernel this workaround
can be removed.

Also drop force power support for MST controllers in the Dell plugin. Overall
this has just led to more problems than it's helped.

 * Monitor flickers when turned on
 * Crashing graphics drivers from time to time
 * Fragile logic that doesn't always represent the device state
2019-08-28 08:50:15 -05:00
Richard Hughes
dfaca2de2e Fix a crash when stopping the fwupd service
This difficult to debug bug only showed up when the fwupd service was stopped,
which the user never noticed, but services like abrt were still keen to report.
The root issue was that the call to fu_plugin_get_smbios_data() in
fu-plugin-uefi.c:fu_plugin_startup() was freeing the returned const GBytes,
which rippled down all the way to a double-free deep in libxmlb.

It's somewhat unusual to have a const GBytes, so just change the plugin helper
to returned a ref'd copy, on the logic a potential 16 byte memory leak is better
than a double-free when the next plugin gets the logic the wrong way around.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1734746
2019-08-01 13:00:51 +01:00
Richard Hughes
5079f26f0e Never guess the version format from the version string
This leads to madness, as some formats are supersets of the detected types,
e.g. 'intel-me' is detected as 'quad' and 'bcd' is detected as 'pair'.

Where the version format is defined in a specification or hardcoded in the
source use a hardcoded enum value, otherwise use a quirk override.

Additionally, warn if the version does not match the defined version format
2019-04-30 09:25:41 +01:00
Richard Hughes
c84b36c541 Export the version-format to clients
This allows a vendor to verify the VersionFormat of a device without running
the daemon in verbose mode.
2019-04-30 09:25:41 +01:00
Richard Hughes
cce6a1cb5a Do not report transient failures
We don't need to report failures to do with AC or battery level to the LVFS.
2019-04-17 08:20:44 +08:00
Richard Hughes
6b78d64987 Add fwupd_guid_from_string() to drop dep on uuid
This also allows us to write mixed-endian structures and adds tests. As part of
this commit we've also changed the API of something that's not yet been in any
tarball release, so no pitchforks please.
2019-02-06 14:48:04 +00:00
Richard Hughes
65c81921b6 Add fu_device_add_instance_id() and prefer explicit conversion 2019-02-04 15:19:57 +00:00
Richard Hughes
592baedfff Export some of the GUID functionality 2019-02-04 15:19:57 +00:00
Mario Limonciello
769f990cf6 trivial: dell: filter another dock SKU from this plugin
Prevents showing errors in the logs
2019-01-30 11:00:45 -06:00
Mario Limonciello
423dde520c dell: Check that the flash interface command is available
This prevents the kernel showing errors when running on systems
without this command.

Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=202259
2019-01-30 11:00:45 -06:00
Mario Limonciello
b13f784462 trivial: dell: When plugging in a dock supported by dell-dock don't show an error
Some aspects of the method for querying dock firmware do work in 'dell' plugin
but that is not useful for fwupd because it's incomplete.

Due to this the following error shows up in fwupd journal if run on a Dell system
when the new Dell dock is plugged in:
failed to add USB device 0bda:8153: failed to add device using on dell: invalid dock component request Query 3 0 2 4 0

Detect this scenario, and prevent showing errors in logs.
2019-01-22 09:11:50 +00:00
Richard Hughes
f425d29a28 Show a console warning if loading an out-of-tree plugin
Fixes https://github.com/hughsie/fwupd/issues/950
2019-01-19 07:26:20 +00:00
Richard Hughes
05cbb7245c Don't use AppStream-glib for version helpers
Refactor the imported version format code now we now longer need to stick to
the API mistakes of libappstream-glib.
2018-10-11 07:54:01 +01:00
Richard Hughes
d3d2c2c39f Don't use AppStream-glib for the GUID helpers
Long term we want to wean ourselves away from libappstream-glib.
2018-10-11 07:54:01 +01:00
Mario Limonciello
dc48bec157 uefi: Move the TPM unlocking functionality from the Dell to UEFI plugin
This allows devices that have been registered to be correctly unlocked.
2018-10-10 14:30:49 +01:00
Mario Limonciello
4ba77a4fb9 Run the Dell plugin initialization after the UEFI plugin
This corrects the data->esp_path not being initialized due to UEFI
plugin's coldplug routine not having run yet.
2018-10-10 14:30:49 +01:00
Mario Limonciello
20447a00ae dell: Stop showing errors when no dock plugged in
Since it matches the Realtek dongle, shouldn't show this error:

failed to add USB device 0bda:8153: no dock detected

All the time when that dongle is plugged in
2018-09-11 18:59:05 +01:00
Richard Hughes
c125ec02ed Clarify what the platform ID actually is by renaming it
It wasn't hugely clear what the platform ID was actually meant to represent. In
some cases it was being used like a physical ID, in others it was a logical ID,
and in others it was both. In some cases it was even used as a sysfs path.

Clear up all the confusion by splitting the platform ID into two parts, an
optional *physical* ID to represent the electrical connection, and an optional
*logical* ID to disambiguate composite devices with the same physical ID.

Also create an explicit sysfs_path getter for FuUdevDevice to make this clear.

This allows WAIT_FOR_REPLUG to always work, rather than depending on the order
that the GUIDs were added, and that the kernel would always return the same
sysfs path (which it doesn't have to do, especially for hidraw devices).
2018-09-06 16:22:46 +01:00
Richard Hughes
2aa3360d46 trivial: Include appstream-glib.h in the main plugin header 2018-09-04 08:22:39 -05:00
Richard Hughes
ff704414f6 Use superclassed versions of FuDevice when calling udev_added() and usb_added()
The daemon creates a baseclass of either FuUsbDevice or FuUdevDevice when the
devices are added or coldplugged to match the quirk database and to find out
what plugin to run.

This is proxied to plugins, but they are given the GUsbDevice or GUdevDevice and
the FuDevice is just thrown away. Most plugins either use a FuUsbDevice or
superclassed version like FuNvmeDevice and so we re-create the FuDevice, re-probe
the hardware, re-query the quirk database and then return this to the daemon.

In some cases, plugins actually probe the hardware three times (!) by creating
a FuUsbDevice to get the quirks, so that the plugin knows what kind of
superclass to create, which then itself probes the hardware again.

Passing the temporary FuDevice to the plugins means that the simplest ones can
just fu_plugin_device_add() the passed in object, or create a superclass and
incorporate the actual GUsbDevice and all the GUIDs.

This breaks internal plugin API but speeds up startup substantially and deletes
a lot of code.
2018-09-04 08:22:39 -05:00
Mario Limonciello
cc722dbb2c dell: Adjust for changes in daemon around USB removal
1) Switch to daemon provided vfuncs for USB
2) Set quirks so that the plugin only runs when Realtek NIC shows up
3) Rely on the daemon to process all removals by parent tree
2018-09-04 10:00:52 +01:00
Mario Limonciello
e3b1a3f558 Plumb through support to set FwupdInstallFlags for update_prepare/update_cleanup
This will be used by other future commits.
2018-08-21 13:49:38 -05:00
Richard Hughes
02c90d8a03 Remove the unused Emacs indenting headers from all source files
Fixes https://github.com/hughsie/fwupd/issues/636
2018-08-09 12:48:04 +01:00
Mario Limonciello
801cca6dc3 synapticsmst: remove support for setting dock type from another plugin
As seen by recent testing this is not working every time.
Since e6cda81f we're now building GUIDs that represent all the possibilities
for shared parts so it's not important to set dock type.
2018-08-06 00:34:42 -05:00
Mario Limonciello
7154f63397 trivial: Adjust syntax of varying copyright holders to unify across project 2018-08-05 08:22:23 -05:00
Mario Limonciello
0e00ed9b13 dell: Show error messages when capsule updates are disabled 2018-07-18 16:32:26 -05:00
Mario Limonciello
6c41292bdb trivial: dell: drop blacklist of old systems
The minimum version of libsmbios is now 2.4, so don't include any
code blacklisting running on known failing systems.
2018-07-13 13:04:42 -05:00
Richard Hughes
1ccf35a9e4 dell: Register devices with the uefi plugin rather than using libfwup directly
The device registration allows us to create a 'virtual' device that can accept
capsule updates that is not found in the ESRT.
2018-06-28 15:51:11 +01:00
Richard Hughes
87fb9ff447 Change the quirk file structure to be more efficient
This pivots the data storage so that the group is used as the preconditon
and the key name is used as the parameter to change. This allows a more natural
data flow, where a new device needs one new group and a few few keys, rather
than multiple groups, each with one key.

This also allows us to remove the key globbing when matching the version format
which is often a source of confusion.

Whilst changing all the quirk files, change the key prefixes to be more familiar
to Windows users (e.g. Hwid -> Smbios, and FuUsbDevice -> DeviceInstanceId)
who have to use the same IDs in Windows Update.

This also allows us to pre-match the desired plugin, rather than calling the
probe() function on each plugin.
2018-06-28 13:32:30 +01:00
Richard Hughes
e48351e260 Set the alternate device ID, not the object itself
If the daemon either de-duplicates or replaces the object passed emitted from
device-added then the object set as the alternate may not be the same instance
as the daemon version. This causes weird things to happen.

To make this less fragile, specify the *ID* of the object that should be the
alternate device, which allows the daemon to do clever things, and then assign
the object from the ID as the last step.

Although fixing no bug, this makes implementing future functionality easier.
2018-06-22 13:28:27 +01:00
Richard Hughes
8a6fdf8e18 dell: Don't crash when the alternate device has not been set
I don't think this is possible, but it's the right thing to do...
2018-06-22 13:28:27 +01:00
Richard Hughes
80b2c237c2 dell: Don't show '(null)' as the product name in the self tests 2018-06-22 13:28:27 +01:00
Mario Limonciello
51308e648a Adjust all licensing to LGPL 2.1+ (Closes: #526) 2018-05-29 09:03:13 +01:00
Mario Limonciello
542b97d19f dell: Set parents for Dell WD15/TB16 docks 2018-05-03 08:07:04 +01:00
Mario Limonciello
4a981d599c dell: Set TPM alternate mode device under regular mode 2018-05-03 08:07:04 +01:00
Richard Hughes
b01b4869bb trivial: Use fu_plugin_add_runtime_version() in the Dell plugin 2018-04-20 20:45:08 +01:00
Mario Limonciello
a98df55d82 Disable -Wunused-function on clang builds (Closes #467)
GLib creates two static inline functions for paramaters that may
not be used that set off warnings in clang but not gcc.

Ignore these on clang builds everywhere that
G_DEFINE_AUTOPTR_CLEANUP_FUNC is used.
2018-04-17 10:10:43 +01:00
Sjoerd Simons
9f10cbacaf Set Dell dock metadata
On Dell dock devices set the FU_DEVICE_METADATA_DELL_DOCK_TYPE metadata
field which gets used by the synapticsmst plugin for recognizing dell
dock types.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2018-04-10 15:57:59 -05:00
Mario Limonciello
e37cd0d8ce dell: Report Libsmbios version in metadata 2018-02-06 19:29:28 +00:00
Mario Limonciello
9f932edaca trivial: dell: blacklist another system when used with older libsmbios
The reporter confirmed that changes in libmsbios 2.4.0 fix the problem
however.
Bug: https://bugs.launchpad.net/ubuntu/+source/libsmbios/+bug/1744782
2018-01-31 13:59:42 -06:00
Mario Limonciello
3780bb5c0d dell: Add a test for libsmbios version
This will be useful in the future for debugging crashes with known
problematic versions of libsmbios.

Also use this information to turn off the blacklist from previously
bad known combinations of libsmbios + certain systems
2018-01-27 22:48:36 -06:00
Richard Hughes
2de8f13b2c Allow each plugin to opt-in to the recoldplug action
Recoldplug is really not required for the USB based plugins, and we should
restrict this action to plugins that have inter-dependencies on each other.
2018-01-17 20:19:58 +00:00
Mario Limonciello
736be7440f dell: block owned TPM updates (#339)
Also make it clearer what the logic is checking.
2017-12-13 12:13:33 -06:00