Commit Graph

288 Commits

Author SHA1 Message Date
Richard Hughes
2b9b9f359b trivial: Fix a false-positive noticed by clang 2017-11-09 12:16:53 +00:00
Richard Hughes
2ec78d68db Add support for HWID requirements
In the latest version of the LVFS you can restrict the firmware to a specific
machine type, for instance a specific baseboard vendor. This is the same as
done in Microsoft Update using the CHID mechanism.

This commit adds support for the <hardware> requires type, although it needs to
be built against appstream-glib 0.7.4 to be supported and/or tested.
2017-11-03 23:42:57 +00:00
Richard Hughes
9c028f06b5 Move the database of supported devices out into runtime loaded files
When fwupd is installed in long-term support distros it's very hard to backport
new versions as new hardware is released.

There are several reasons why we can't just include the mapping and quirk
information in the AppStream metadata:

 * The extra data is hugely specific to the installed fwupd plugin versions
 * The device-id is per-device, and the mapping is usually per-plugin
 * Often the information is needed before the FuDevice is created
 * There are security implications in allowing plugins to handle new devices

The idea with quirks is that the end user can drop an additional (or replace
an existing) file in a .d director with a simple format and the hardware will
magically start working. This assumes no new quirks are required, as this would
obviously need code changes, but allows us to get most existing devices working
in an easy way without the user compiling anything.

This allows us to fix issues like https://github.com/hughsie/fwupd/issues/265
2017-11-02 19:08:51 +00:00
Richard Hughes
642ec13754 trivial: Remove GetUpdates as it is no longer used 2017-09-28 09:23:52 +01:00
Richard Hughes
7ada7a8678 Add support for SMBIOSv3
Fixes https://github.com/hughsie/fwupd/issues/262
2017-09-20 22:08:21 +01:00
Richard Hughes
34e25a0cc5 trivial: Remove EnableTestSuite from daemon.conf
The same thing can be done using BlacklistPlugins=test
2017-09-19 20:06:44 +01:00
Richard Hughes
7769fb8da7 trivial: Add some more FuEngine self tests 2017-09-18 11:12:52 +01:00
Richard Hughes
b5b4beb472 Fix various printing issues with the progressbar
Specifically, fix the progressbar to:

 * Print at 100% after an 'unknown' percentage task has completed
 * Refresh the progressbar if being called without a main loop running
 * Allow the progressbar to start with a h-offset without moving 'left'
 * Don't cause high CPU load when calling fu_progressbar_update() ever few us

Also, add some unit tests to discover all the issues.
2017-09-17 08:56:05 +01:00
Richard Hughes
882ab6b4d0 trivial: Add a self tests for the broken metadata bug 2017-09-16 17:53:16 +01:00
Richard Hughes
820dac7fde trivial: Use a different SYSFSFIRMWAREDIR for self tests
This means we can drop some self-test specific code in fu_smbios_setup().
2017-09-16 17:46:41 +01:00
Richard Hughes
cc3de2efa4 Do not store the newest release as part of the FuDevice object 2017-09-15 14:12:18 +01:00
Richard Hughes
68982c6624 Make FuDevice derive from FwupdDevice rather than FwupdResult
We're aiming for a model where devices can have multiple releases and we can
nuke FwupdResult completely.
2017-09-15 14:12:18 +01:00
Richard Hughes
9dde04fbda trivial: Split out some functionality not to be used by plugins 2017-09-13 14:59:32 +01:00
Richard Hughes
a1aab517d1 Move the update state to FwupdDevice
It only remained on FwupdResult because I couldn't make up my mind about whether
it was a property of the device, or the firmware release. It's more logically
the former, and that's how plugins are using it.
2017-09-13 14:59:32 +01:00
Richard Hughes
7c52580f9c Add FuDeviceLocker to simplify device open/close lifecycles
We can use the power of g_autoptr() to automatically close devices that have
gone out of scope. When everything is converted we can drop the GUsbContect
AUTO_OPEN_DEVICES flag which is making us look bad in powertop.
2017-09-07 19:00:51 +01:00
Richard Hughes
49e5e05aa8 Parse the SMBIOS DMI table directly
The Linux DMI class still does not provide the information we need, and parsing
the blob directly also allows the Dell and Redfish plugins to get the raw data.
2017-09-05 18:10:36 +01:00
Yehezkel Bernat
e43f7fb655 trivial: cleanup for many compilation warnings from clang
Signed-off-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
2017-08-30 10:43:15 +01:00
Richard Hughes
55566b53e6 Allow plugins to set boolean and integer metadata
Handling this in one place prevents plugins setting different values for
non-string values like TRUE/false or with different ways to represent integers.
2017-08-25 09:22:05 +01:00
Richard Hughes
e1fd34d5f1 Allow plugins to set metadata on devices created by other plugins
This could be used, for instance, to set a property on ThunderBolt controllers
inside Dell computers saying that they support forcing the power level during
coldplug. It could also be used to set the dock type for the synapticsmst hub.

Adding this level of complexity allows us to avoid the creep of HAVE_DELL and
HAVE_LENOVO into seemingly unrelated plugins, and also allows us to have
multiple vendor plugins providing the same end result with two different
vendor-specific mechanisms.
2017-08-24 16:15:11 +01:00
Richard Hughes
f03f386c68 trivial: Add a test for firmware signed with a derivative of the LVFS key
This also switches around the test for the self signed key to now fail, as the
generated certificate is no longer loaded into the trust list. This is a more
useful test as it more accurately represents what the fwupd daemon is doing.

As a side-note the detached signature from the derivate cannot be generated
using `--no-p7-include-cert` as only the main LVFS-CA certificate is shipped
with fwupd.
2017-08-18 12:11:59 +01:00
Richard Hughes
14047d7d24 trivial: Split up the keyring setup and public key adding 2017-08-18 11:10:03 +01:00
Richard Hughes
f69a4810fa Return the authority and timestamp as part of the signing validation
This means we return an error when encountering a rollback attack. This can
currently be performed by providing the old metadata and old signature when
calling into UpdateMetadata.
2017-08-17 16:15:47 +01:00
Richard Hughes
7403dc505f Optionally use GnuTLS to verify PKCS7 certificates
We can use this as an alternative for GPG. No PKCS7 certificates are currently
installed by fwupd and it's expected that the LVFS will still only provide GPG
detached signatures.

If an OEM distributor wants to sign firmware with a PKCS7 and the corresponding
certificate is provided then the firmware will be marked as valid.

Only firmware shipping with a .p7b file will use the PKCS7 functionality,
similarly remote metadata validation will default to GPG unless Keyring=pkcs7
is specified in the config file.
2017-08-14 09:42:48 +01:00
Richard Hughes
0724d8bde0 trivial: Bump the appstream-glib requirement to 0.6.13 2017-08-09 17:21:48 +01:00
Richard Hughes
f6f72a439e trivial: Look for bwrap executable in the path 2017-08-09 16:25:25 +01:00
Richard Hughes
049ccc8f6c Add a helper function to spawn a subprocess
This allows us to watch the output of a flashing tool and screen-scrape the
progress completion.
2017-08-09 15:35:58 +01:00
Richard Hughes
41cbe2aab3 Add a firmware builder
This runs a script inside the firmware archive to generate firmware specific to
the machine. This uses bubblewrap to protect the local machine.
2017-08-09 10:33:39 +01:00
Richard Hughes
d7704d4cc2 Allow plugins to get DMI data from the hardware in a safe way
The returned strings are converted to ASCII and have leading and trailing
spaces removed.
2017-08-09 10:19:13 +01:00
Richard Hughes
ca52a8541e trivial: Fix self tests after downgrading warnings commit 2017-07-21 15:42:32 +01:00
Mario Limonciello
dc8c985159 trivial: back the requirement on appstream-glib to 0.6.9
The items that 0.6.13 requires are now guarded by a version test.
This should allow running fwupd master on more distros that haven't
yet picked up appstream-glib 0.6.13.
2017-07-10 14:32:42 -05:00
Mario Limonciello
f3f4390155 Only use the test runner plugin when CI is set in the env (#148)
This prevents an installed system from showing FakeDevices but
still allows exercising every commit with Travis CI
2017-06-20 13:56:13 -05:00
Richard Hughes
ae7e0d21b2 Add an installed test for verification 2017-06-15 16:23:52 +01:00
Richard Hughes
6d7c33c5da trivial: Fix two tiny leaks in the new HWIDs support 2017-06-07 15:34:53 +01:00
Richard Hughes
1642b3b95a Deprecate the old FwupdResult API
It will be removed next time we bump soname.
2017-06-05 17:41:11 +01:00
Richard Hughes
b8f8db2082 Add support for Microsoft HardwareIDs
This commit provides a new "hwids" subcommand for fwupdmgr that shows the
hardware GUIDs on the local system. It also provides API that plugins can use
to self-disable when a specific HWID does not match.

The GUIDs used in this implementation match that of ComputerHardwareIds.exe
2017-06-04 19:46:36 +01:00
Richard Hughes
9f0c47b36a Fix the raspberrypi self test code under meson
Also, refactor the common test code to a new source file.
2017-04-13 10:09:33 +01:00
Richard Hughes
24a580f622 trivial: Allow TESTDATADIR to be multiple locations
We need this when srcdir != destdir.
2017-04-12 16:34:17 +01:00
Richard Hughes
d3f4b5a428 trivial: Define the build dir outside the source file 2017-04-12 14:26:14 +01:00
Richard Hughes
6ad951d27c trivial: Do not allow plugins to call _device_add_delay() with the same device
Also, add some unit tests for this codepath.
2017-02-03 10:12:14 +00:00
Richard Hughes
74702297b2 Move the Option ROM parsing to the Udev plugin 2016-12-15 17:09:38 +00:00
Richard Hughes
cff38bcb3a Convert the providers to plugins to simplify code and for future features
This is a large commit that removes all the providers and turns them into
plugins. I think having both providers _and_ plugins was super confusing.

Plugins are loaded at runtime so you could in theory develop a new plugin
without putting it in the fwupd source tree, although there are no installed
headers or PC files as I'm not sure it's a good idea at this stage.

This commit moves all the per-provider docs, tests, notes, debug dumps and test
data to plugin-specific directories -- these also allows the plugin author to
"own" more of the source tree so we don't enforce fu- prefixes and the style
guide everywhere.

This allows us to run the same action on all the plugins in the future, so we
could have a prepare(FuPlugin, FuDevice) and cleanup(FuPlugin, FuDevice) run
on *all* plugins, so doing an update using one plugin would allow us to work
around hardware quirks in other plugins.

If I've broken your out-of-tree provider it's trivial to port to the new API
with sed and a fixed up build file. If you need help please let me know.
2016-12-12 12:31:23 +00:00
Richard Hughes
644562e291 Use the correct define prefix for FwupdDeviceFlags
Also, add the compat flags so we don't break API.
2016-08-22 10:30:24 +01:00
Richard Hughes
f192bf025a trivial: Switch to compiling with C99 by default
We're already using non-MSVC features like g_autoptr().
2016-07-22 08:41:59 +01:00
Mario Limonciello
09e2630a59 trivial: re-enable Dell self tests 2016-07-18 09:32:24 -05:00
Richard Hughes
3ddb6d90b6 trivial: Disable the Dell self tests until they compile 2016-07-18 09:24:14 +01:00
Mario Limonciello
958ead697b Add Dell TPM and TB15/WD15 support via new Dell provider.
This provider will provide support for items that can be flashed
as capsules but aren't present in the ESRT table.

The MST hub and TBT NVM are not yet updatable, but GUIDs are
created to represent them when they are.
2016-07-13 12:30:25 -05:00
Richard Hughes
ce38d94d5e trivial: Get rid of useless internal-only gtk-doc markup 2016-06-29 11:25:25 +01:00
Richard Hughes
99147f180b Allow devices to have multiple assigned GUIDs 2016-05-17 09:35:04 +01:00
Richard Hughes
f76956be6f Make the device display name nicer 2016-04-15 09:02:28 +01:00
Richard Hughes
f7c81e312a Allow the test suite to run in %check 2016-04-01 10:25:05 +01:00
Richard Hughes
f3f4e8dae5 Revert "Allow overriding the location of the provider offline files for test suite"
This reverts commit 661cd75b41.
2016-04-01 10:25:05 +01:00
Richard Hughes
06c804890a Revert "Allow overridding the location of the pending database for test suite"
This reverts commit 5c1999b4ec.
2016-04-01 10:25:05 +01:00
Mario Limonciello
661cd75b41 Allow overriding the location of the provider offline files for test suite 2016-03-31 13:41:14 -05:00
Mario Limonciello
5c1999b4ec Allow overridding the location of the pending database for test suite 2016-03-31 13:37:33 -05:00
Richard Hughes
2d6e186800 Rename some of the new libfwupd API to align with the D-Bus names 2016-03-18 09:20:40 +00:00
Richard Hughes
c8a60c9073 trivial: Squash a warning when compiling the self tests 2016-03-17 13:09:51 +00:00
Richard Hughes
8e9762d174 Use libfwupd inside the daemon
This also entailed writing some compat defines to work on FuDevices without
casting each one to a FwupdResult.
2016-03-17 10:14:17 +00:00
Richard Hughes
b94f2f0488 Export FwupdUpdateFlags in libfwupd 2016-03-17 09:52:00 +00:00
Richard Hughes
a475eecda2 Export FwupdUpdateState in libfwupd 2016-03-17 09:48:34 +00:00
Richard Hughes
dad1e193cd Run vendor plugins as required
This allows us to run plugins from AppStream metadata values.
2016-03-14 14:54:21 +00:00
Richard Hughes
7d79e580bb Use the same device identification string format as Microsoft
Using our own special version for the input for the GUID calculations means
that the result is not 'googlable'.

This does have the result of changing the GUIDs stored in the 'verify' database
but given the string->GUID function in appstream-glib has also changed to
become standards compliant and that only a few people are using it I felt it
was worth the pain.
2015-11-15 11:02:33 +00:00
Richard Hughes
01d9ac56f0 trivial: Fix make check 2015-10-08 19:57:03 +01:00
Richard Hughes
5d14deff4a Support cabinet archives files with more than one firmware
This allows a vendor to upload a single file that targets different versions of
the same hardware. If this feature is used, the metainfo.xml files *must* have
something like <checksum target="content" filename="firmware2.rom"/> inside the
latest <release> tag.
2015-10-07 17:45:11 +01:00
Richard Hughes
46832432ea Raise the dep on GLib to support and use g_autoptr() 2015-09-11 13:43:15 +01:00
Richard Hughes
2257cee8ee Simplify the version properties on devices to avoid complexity and bugs
This reduces the number of 'version' properties from 4 to 2... We can just use
these consistently to mean 'older' and 'newer'.
2015-09-08 16:53:49 +01:00
Richard Hughes
51f5083b09 Depend on appstream-glib >= 0.5.0 2015-09-08 16:53:49 +01:00
Richard Hughes
ff7e6ceb98 Generate the ColorHug test files at runtime
Also, fix the firmware.inf to have the correct ClassGuid.
2015-08-12 09:09:28 +01:00
Richard Hughes
25cf6ab53e Add a Raspberry Pi firmware provider
This queries the current firmware version and also allows online or offline
updating.
2015-08-05 12:14:56 +01:00
Richard Hughes
d51173d448 Allow no arguments to 'fwupdmgr verify-update' and use sane defaults
Reading firmware from devices and writing to the default path will typically
require authentication.
2015-07-30 19:56:04 +01:00
Richard Hughes
04ee5856d0 Sign the test binary with the correct key
Use the LVFS key rather than my own GPG key, and load that in the self tests.

Fixes https://github.com/hughsie/fwupd/issues/14
2015-07-28 09:47:03 +01:00
Richard Hughes
31477cf4e7 trivial: Fix make distcheck 2015-07-25 14:51:36 +01:00
Richard Hughes
1a886b1b76 Allow cab files to be saved
This means reworking the way we load the file as we have to keep the full
filelist in case we have to re-extract and save each and every file.
2015-07-20 15:31:05 +01:00
Richard Hughes
8ffbd403cb Fix ROM PPID searching to work for all ROMs 2015-07-08 14:28:53 +01:00
Richard Hughes
fe68ff584f Make the version parsing more resilient to corrupt firmware 2015-07-03 12:37:56 +01:00
Richard Hughes
c14aa63c25 Actually parse the PCI option ROM
This allows us to get more details about the firmware.
2015-07-01 11:52:02 +01:00
Richard Hughes
4b41e737b1 Make the ROM parsing more robust and add self tests
This code can now parse 99.6% of all the user-submitted firmwares from the
http://www.techpowerup.com/vgabios/ database.
2015-06-30 14:00:31 +01:00
Richard Hughes
d8a02bfeeb Run the offline actions using systemd when required 2015-04-25 17:14:20 +01:00
Richard Hughes
8a08f9d8f3 Verify firmware if a detached signature is present 2015-04-14 15:41:44 +01:00
Richard Hughes
36a889034c Add helper code to validate public key signatures
We'll use this in the future for checking device firmware.
2015-04-14 13:53:19 +01:00
Richard Hughes
8ccb1af4fe trivial: Use the ALS firmware with signed payload 2015-04-14 13:44:35 +01:00
Richard Hughes
f910ac9541 trivial: Also export the status enum codes 2015-03-19 10:54:06 +00:00
Richard Hughes
8645ec9ad5 Create a libfwupd shared library 2015-03-19 10:54:05 +00:00
Richard Hughes
0e883ee815 Add and document the offline-update lifecycle
Also allow providers to override getting and clearing the last update status.
2015-03-19 10:31:23 +00:00
Richard Hughes
310419856b trivial: Add some files ready for a first release 2015-03-16 12:51:04 +00:00
Richard Hughes
bbac6d7932 Return some more fields when returning data about firmware files 2015-03-12 11:41:20 +00:00
Richard Hughes
cccc775b60 Add a method to get details about a firmware file 2015-03-09 11:04:32 +00:00
Richard Hughes
412034adaa Add actual error codes for failure 2015-03-05 11:30:58 +00:00
Richard Hughes
d1e823ccbf Allow scheduling updates for later
Also add a update-prepared command to fwupdmgr to process the defered updates.
In the future we'll hook into the systemd early-boot code for this.
2015-03-05 11:15:36 +00:00