Commit Graph

182 Commits

Author SHA1 Message Date
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
e58ad0bd77 trivial: dell: Assert true in self tests 2018-09-21 07:35:08 +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
Mario Limonciello
b900fe6b4e trivial: move all Dell dock related quirks into dell.quirk
These quirks aren't really needed if compiled without the Dell plugin
since they just set the parentage.
2018-09-05 08:10:52 -05:00
Richard Hughes
2aa3360d46 trivial: Include appstream-glib.h in the main plugin header 2018-09-04 08:22:39 -05:00
Richard Hughes
4adf3bb52c trivial: Remove duplicate header includes 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
Richard Hughes
95227a919d trivial: Move gudev to the core plugin deps 2018-08-26 19:38:58 +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
f83adbab56 dell: Fix a tiny memory leak in the self test wrapper 2018-06-28 19:08:39 +01: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
1107fa4c9a dell: Do not rely of the order the devices are added in the self tests
Get the TPM v2.0 and v1.2 devices explictly rather than assuming the non-alt
device is always added first. This has the side effect of making the tests
easier to read and means we can check the dock components more carefully.
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
Richard Hughes
4be17d1364 Add support for relocating various runtime paths
This allows a snap package to be easily built.

With much help from Mario Limonciello <mario.limonciello@dell.com>, many thanks.
2018-05-31 16:25:22 +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
Richard Hughes
23135eb1c9 trivial: Remove the now-unused fu_plugin_set_status() 2017-12-04 17:00:22 +00:00
Richard Hughes
4a036018f7 Set the progress and state on the FuDevice, not the FuPlugin
This makes more sense; we're updating the device, not the plugin itself.

This also means we don't need to funnel everything through callbacks like
GFileProgressCallback and we can also update the state without adding an
explicit callback to each derived device type.
2017-11-30 20:51:52 +00:00
Richard Hughes
d0cff7caec Remove autoconf-isms from the meson configure options
See https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
2017-11-27 18:07:53 +00:00
Jan Tojnar
cc9f934787 build: Refactor directory selection
Previously, the various install paths were obtained using get_option
as needed.

This patch unifies the directory selection inside the top-level meson
file as requested in https://github.com/hughsie/colord/pull/62.
2017-11-17 17:11:51 +00:00
Mario Limonciello
2e52dc2242 dell: disable plugin if libsmbios fails 2017-11-14 13:20:59 -06:00
Mario Limonciello
20e856ccbe dell: activate libsmbios_c debugging output with --plugin-verbose=dell 2017-11-14 12:00:49 -06:00
Richard Hughes
a14d771476 dell: Fix a trivial warning spotted by clang 2017-11-09 12:15:55 +00:00
Mario Limonciello
7f3bfc9d99 dell: catch invalid dock component requests
Test if g_strrstr returns NULL, as this means the string was
modified and other requests predicated on this will fail miserably.
2017-11-07 09:46:36 -06:00
Mario Limonciello
3164784d9e dell: fix crashes when enumerating with dock connected but UEFI capsule off
Crashes will happen when UEFI capsule is turned off due to fwupdate
trying to do a SMI request that invalidates the buffer used by fwupd.

This is due to both fwupdate and fwupd using libsmbios in the same process.
Fixes: https://bugs.launchpad.net/ubuntu/+source/fwupd/+bug/1726367
2017-11-07 09:46:36 -06:00
Richard Hughes
74a80ccc50 dell: Use the new quirk infrastructure for version numbers 2017-11-02 19:08:51 +00:00
Mario Limonciello
bd0f3f8920 rename fu-dell-common to fu-dell-smi
Since it's not being used by other plugins, make it represent
what it really does now.
2017-10-18 08:27:54 -05:00
Mario Limonciello
7af941fee4 synaptics: drop hard dependency on dell plugin and libsmbios
Rather than have a hard dependency use metadata and internal DMI
to communicate the relevant details
2017-10-18 08:27:38 -05:00
Mario Limonciello
ed538c2b84 drop fu_dell_get_cable_type, unused 2017-10-18 08:22:43 -05:00
Richard Hughes
4212f40e9d trivial: Fix failure to build on i386 2017-10-09 12:17:02 +01:00
Mario Limonciello
26767845f1 trivial: dell: add missing icon for TPM devices 2017-09-28 10:25:30 -04:00
Mario Limonciello
5a8e8ee88d dell: only set coldplug delay when we know we need it
It's not very common to have a system with a Synaptics MST hub or
a dock plugged in.  Avoid slowing down fwupd enumeration in the
common scenario.
2017-09-26 08:56:07 -04:00
Mario Limonciello
e401edd107 dell: only run SMI to toggle host MST GPIO on systems with host MST
As type-C docks become more common MST controllers in the host are
going to become rarer.  This should be a manageable whitelist
and prevent running the SMI on the majority of systems.
2017-09-26 08:56:07 -04:00
Mario Limonciello
5a3ff3a446 trivial: dell create a function for looking up system ID
Enough places look for it that code duplication should go away.
2017-09-26 08:56:07 -04:00
Mario Limonciello
48cae2cb5e dell: add functionality to blacklist HW with problems
This is certainly a problem lower in the stack, but at least provide
a method to block these systems from bringing down fwupd until it's
fixed.
2017-09-26 08:56:07 -04:00
Mario Limonciello
e0e6a0b885 dell: only run on intended chassis
For example if trying to run on a server, they might support some
dell SMI but are architected differently.
2017-09-26 08:56:07 -04:00
Mario Limonciello
39c4436c3d trivial: dell: move fu_dell_supported into plugin
Eventually fu-dell-common will not be used by synaptics, and it's
already not using this function.
2017-09-21 06:23:24 +08:00
Mario Limonciello
1edb50ed2f trivial: dell: remove needless includes 2017-09-20 09:11:02 -05:00
Mario Limonciello
9a30ef284d dell: prefer to use hwids to get DMI keys and DE table
libsmbios is still used as a fallback in some cases, mostly
because it's not clear whether or not ProductSKU is available
in all instances.
2017-09-20 09:11:02 -05:00
Mario Limonciello
9ff5670b3d drop fu-dell-tool
It's been superceded by the thunderbolt power plugin
2017-09-18 17:13:12 -05:00
Richard Hughes
9decf17d82 dell: Fix a trivial whitespace issue 2017-09-16 18:52:44 +01:00
Mario Limonciello
9d84b22d7b dell: drop thunderbolt force power code
This is replaced by the WMI force power interface.
2017-09-13 03:12:50 +08:00
Richard Hughes
c1c2fec6f5 Add optional icons to each device
This allows us to show the devices in a GUI with a nice icon. Some of the icon
mappings are not perfect and I'll be asking the GNOME designers for some
additions to the icon specification.

Custom vendor icons can also be specified, and /usr/share/fwupd/icons would be
a good place to put them. If vendor icons are used they should show a physical
device with the branding, rather than just the vendor logo.
2017-09-11 17:27:35 +01:00
Richard Hughes
9bfcfd88cf Ensure more devices set the device summary
This helps users identify what the device actually does.
2017-09-11 15:10:50 +01:00
Richard Hughes
5720fc9d90 trivial: Add more vendor information to devices 2017-09-11 10:11:34 +01:00
Richard Hughes
7ac92109eb trivial: Remove useless config.h defines
The HAVE_UEFI_UNLOCK and HAVE_UEFI_GUID defines are always present for the
libfwup version we require.
2017-09-06 23:07:50 +01:00
Mario Limonciello
bb9d3b14dd Revert "dell: prefer to detect supported systems from OEM strings"
This reverts commit 257c14ebd1.

Although this is the preferable way to detect Dell systems this was
leading to executing SMI on some systems with problems.
libsmbios has some memory issues that need to be fixed first.
2017-08-31 16:48:45 -05:00
Mario Limonciello
a65ce8392b trivial: use fu_device_has_flag instead of fwupd_device_has_flag 2017-08-31 13:11:27 -05:00
Mario Limonciello
d63e7317db trivial: dell: turn device back on for thunderbolt plugin, not tbtfwu plugin 2017-08-31 13:00:32 -05:00
Mario Limonciello
c2ed0cb2bc trivial: update remaining use of ALLOW_ONLINE to UPDATABLE 2017-08-31 12:59:26 -05:00
Richard Hughes
e655008a73 trivial: Fix starting conditions in the self tests
Found using Coverity.
2017-08-30 15:06:06 +01:00
Richard Hughes
b95b75a211 trivial: Remove unused function in the dell plugin
Fixes: https://github.com/hughsie/fwupd/issues/209
2017-08-30 10:54:29 +01:00
Mario Limonciello
f1cc61d2f0 trivial: dell: TPM switching blacklist->whitelist
It's been decided that TPM mode switching won't be supported
on any other new platforms.  Instead of blacklisting the outliers
whitelist the (smaller) list of platforms that do support the
feature.
2017-08-29 16:37:14 -05:00
Mario Limonciello
257c14ebd1 dell: prefer to detect supported systems from OEM strings
This requires dmidecode 3.1 or later.
SMBIOS tables are not a reliable enough method on all systems.
2017-08-29 16:37:14 -05:00
Mario Limonciello
1790115c93 trivial: dell: don't advertise ---force in an error message 2017-08-29 15:23:00 -05:00
Yehezkel Bernat
f8e5622726 trivial: fix compilation warning
Signed-off-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
2017-08-29 14:48:45 -05:00
Mario Limonciello
7291c5b3ba trivial: fix TBT controller safe mode handling on Dell
- Set initial (invalid) GUID for TBT controller
- Don't set updatable unless GUID has been refreshed
- Correct the string used for GUID in Dell plugin
2017-08-28 13:24:59 -05:00
Richard Hughes
91628ff8b6 dell: Use fu_device_has_flag() in the self tests 2017-08-26 18:09:21 +01:00
Richard Hughes
a785a1c2f6 Remove the confusing ALLOW_OFFLINE and ALLOW_ONLINE flags
Over the months the original meaning of ALLOW_OFFLINE and ALLOW_ONLINE have be
lost, and there is now a confusing mixture of uses in the source tree. With this
commit we make it clear the UPDATABLE flag is used to specify when the device is
updatable (e.g. from the desktop live session, or from the systemd offline
updates mode, or both) and the NEEDS_REBOOT flag lets us know when the update
is actually going to be done.

For instance, a UEFI UpdateCapsule can be *scheduled* from either the desktop
or from the update mode (but the latter would be a bit weird), but does require
a reboot. Some devices might only be updatable outside the live session, for
instance a hard drive update or a GPU update -- there's just too much going on
with a live session and we want to tightly control what's running during the
firmware flash.

This also means we don't have to "retry" the update when scheduling an update
that really can be scheduled whenever, but just requires a reboot to apply.
2017-08-26 18:09:21 +01:00
Mario Limonciello
3bc251b3a8 thunderbolt: when in safe mode on a Dell system look up VID/DID from SMBIOS
Signed-off-by: Richard Hughes <richard@hughsie.com>
2017-08-25 09:46:41 +01:00
Mario Limonciello
35a0e864b8 Introduce concept of CanForcePower to turn on TBT controllers
Supported Dell devices will use this to turn on ThunderBolt controllers
during coldplug.
2017-08-25 09:35:46 +01:00
Richard Hughes
c788134f75 trivial: Ensure that all the C source files include 'config.h' 2017-08-23 18:26:29 +01:00
Richard Hughes
e7472a22cc Use a static library to avoid symlinking files for the tests 2017-08-09 10:19:13 +01:00
Richard Hughes
260e970297 Rename the thunderbolt plugin to tbtfwu 2017-07-30 17:39:25 +01:00
Richard Hughes
f592b06722 dell: Fix the last of the memory leaks in the self tests
Fixes: https://github.com/hughsie/fwupd/issues/158
2017-07-24 10:55:03 +01:00
Richard Hughes
4bfcae2921 trivial: Fix a tiny leak in the Dell plugin 2017-07-24 10:51:29 +01:00
Mario Limonciello
5f6a574fd7 fix some more memory leaks in dell plugin (#158) 2017-07-21 13:17:47 -05:00
Richard Hughes
061ad8c5e8 trivial: Make fu_dell_detect_dock() slightly more NULL-deref safe 2017-07-19 09:14:56 +01:00
Mario Limonciello
11ca8122c3 Revert "trivial: fix some more memory leaks in dell plugin (#158)"
This reverts commit 49aba8cd87.

That was prematurely committed, my apologies.
2017-07-18 16:00:03 -05:00
Mario Limonciello
32899e5ff7 dell: use plugin hash table instead 2017-07-18 15:53:38 -05:00
Mario Limonciello
49aba8cd87 trivial: fix some more memory leaks in dell plugin (#158) 2017-07-18 15:53:38 -05:00
Mario Limonciello
d817c53697 Correct a memory leak in Dell plugin (Fixes #158) 2017-07-18 10:35:21 -05:00
Mario Limonciello
c7e5322454 dell, uefi: Display all errors recorded by efi_error tracing, not just the first one 2017-07-10 14:11:10 -05:00
Mario Limonciello
c1a4bd469d uefi,dell: make error messages from installing capsules useful
Before:
$ fwupdmgr install XPS_test.cab
Retrying as an offline update...
Scheduling…            UEFI firmware update failed: -1

After:
$ fwupdmgr install XPS_test.cab
Retrying as an offline update...
Scheduling…            UEFI firmware update failed: libfwup.c:733 get_paths(): could not find shim or fwup on ESP: No such file or directory
2017-07-06 11:38:33 -05:00
Mario Limonciello
df1f570069 Fix a logic error with testing for a dell system.
Some Lenovo systems were inadvertently matching.
2017-05-25 21:33:54 -05:00
JulianLiu
1d577d6572 enable-dell requires libfwup-dev (#113)
* enable-dell requires libfwup-dev

Add dependency in enable-dell and shared_module('fu_plugin_uefi')
2017-05-02 19:38:15 +01:00
Mario Limonciello
5c1df14d05 fix test suite localstate directory to be a temporary directory 2017-04-20 13:53:19 -05:00
Richard Hughes
1fdb335025 Remove the automake build system 2017-04-13 18:42:08 +01:00