Commit Graph

224 Commits

Author SHA1 Message Date
Richard Hughes
0eb123b986 Allow requiring specific versions of libraries for firmware updates
In some cases firmware can only be installed with an up to date GUsb (e.g. with
some STM-DFU hardware) or with a new version of fwupdate (e.g. any UEFI
UpdateCapsule without a capsule header).

We should be able to match against other software versions like we can the
fwupd version, e.g.

    <requires>
      <id compare="ge" version="0.9.2">org.freedesktop.fwupd</id>
      <id compare="ge" version="11">com.redhat.fwupdate</id>
    </requires>

Also, rather than checking each requirement we know about on the component,
check each requirement on the component about things we know. This ensures we
don't allow firmware to be installs that requires for instance fwupdate 22 when
the runtime version is only being added in fwupdate 12 and up.

This means the following is now an error that will fail to allow the firmware
to be installed:

    <requires>
      <firmware>doesnotexist</firmware>
      <some_future_tag>also_unknown</some_future_tag>
    </requires>

Also add a lot of self tests to test the various new failure modes.

Fixes https://github.com/hughsie/fwupd/issues/463
2018-04-20 16:19:05 +01:00
Mario Limonciello
ce2a8231ea Bump appstream-glib minimum version to 0.7.4
Ubuntu's LTS and Fedora's newest releases have it.  All CI targets
have it.
2018-04-20 09:05:17 -05:00
Richard Hughes
e598fc3447 trivial: Show the VID and PID when failing to add a USB device
Fixes https://github.com/hughsie/fwupd/issues/476
2018-04-19 20:15:09 +01:00
Mario Limonciello
ed1ac2a74b Enable CentOS 7 for CI
There are a lot of hacks here;
 * Pulling newer libappstream-glib from Fedora
 * Pulling a systemd backport
 * Manually installing pillow and pygobject
 * PKCS7 is turned off (gnutls is too old)
2018-04-18 10:25:22 -05:00
Richard Hughes
34e48634af trivial: Fix a critical warning when checking component requirements 2018-02-23 15:26:15 +00:00
Richard Hughes
849914e642 trivial: Don't keep asking the user if they want to report firmware
Don't optimize the device flag away. We need to be able to set the flag on all
devices that match the device ID, not just the one that happens to match now.
2018-02-14 19:57:27 +00:00
Mario Limonciello
44ebdb82d4 fu-engine: Clarify which devices don't have upgrades (Fixes #397) 2018-02-12 16:26:01 -06:00
Richard Hughes
4082d3367b Correctly mark updates as successful even if the device version number is wrong
If the device firmware was set incorrectly make then set it to the release
version so the database update works correctly. We can't do any kind of vercmp
in the database, so use a daemon warning so we can either fix the plugin or
the XML.

This fixes up the issue that the hardware reports '28.00' and the AppStream
release specifies '28.0'.

Fixes: https://github.com/hughsie/fwupd/issues/387
2018-02-09 16:55:09 +00:00
Richard Hughes
c0cd023d31 Be more careful deleting and modifying device history
If this happens:

1.2.3 -> 1.2.4 = failure
1.2.3 -> 1.2.5 = success

...we want to preserve both in the history database so they can both be shared
with the LVFS. Use the device ID and the new and old firmware versions when
modifying and deleting entries.

This fix is made slightly more tricky as we have to drop the PRIMARY KEY
attribute on the device_id, and due to a limitation in SQLite, it means copying
the old history into a new table.
2018-02-07 10:20:19 +00:00
Richard Hughes
65e44cac96 Always return useful information when calling GetResults()
Previous to having the history database we could only notify about firmware that
as installed using the uefi plugin, as that had a few system-wide API calls to
say 'this update failed' or 'this was the error'.

Now we have the local history database not only can we report more details about
the UEFI update (e.g. the old version number) but we can also offer the same
functionality for all other plugins.

Although this does rework how the data for GetResults() is populated, it does
make the FuEngine object quite a lot less confused.

It also fixes a warning in the fwupd plugin for gnome-software, which was
expecting the FwupdRelease to be populated for the FwupdDevice.
2018-02-07 10:20:19 +00:00
Richard Hughes
ee7e764603 trivial: Do not return failure if a device flag is already set
If we have multiple versions of upgrades/downgrades we'll be setting the
REPORTED flags for multiple history entries at once.
2018-02-01 14:01:58 +00:00
Richard Hughes
ad54f65f05 Add FWUPD_DEVICE_FLAG_NOTIFIED
This allows us to record whether we've shown the user a notification (either in
the terminal or in a GUI) that an update failed or was successful.

This can't be done in the session otherwise we'd get a notification for every
different user on the system. Notifying also isn't the same as reporting,
although one can certainly follow on from the latter.
2018-02-01 14:01:18 +00:00
Richard Hughes
534255cff3 Set the RemoteId when using GetDetails
This searches for the release container checksum in any enabled remote and
also sets the SUPPORTED flag if the local file matches.
2018-01-28 20:24:21 +00: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
Richard Hughes
4012754569 trivial: Rename some FuDeviceList methods
The convention we're using is that find() returns the FuDeviceItem and get()
returns the FuDevice, so be consistent.

No code flow changes.
2018-01-16 13:48:51 +00:00
Richard Hughes
7e070c9bd7 Record an error if any NEEDS_REBOOT transaction fails to be applied
In the case of failing to even set up UpdateCapsule, the uefi plugin would
dutifully return SUCCESS as it was referring to the 2nd-to-last update that
actually worked.
2018-01-12 16:50:24 +00:00
Richard Hughes
7984310a65 trivial: Ensure a historical error message is cleared on success 2018-01-12 16:50:24 +00:00
Richard Hughes
d949d961e8 trivial: Pass the device-id to the fu_history_set_X() methods
This allows us to use a FwupdDevice or just use a string for testing.
2018-01-12 16:50:24 +00:00
Richard Hughes
0b9d996d4d trivial: Rename some methods in FuHistory to reflect the device-centric nature 2018-01-12 16:50:24 +00:00
Richard Hughes
f271142c47 trivial: Do not recover the pending update if the boot time is unchanged
This ensures we can restart the fwupd service without marking updates that need
a reboot as failed.
2018-01-12 16:17:27 +00:00
Richard Hughes
59c2ebe5cd Add in the kernel boot time to the uploaded report 2018-01-12 16:17:22 +00:00
Richard Hughes
a899713863 Rescan supported flags when refreshing metadata
The SUPPORTED flag is used when a device appears in the AppStream metadata of
any enabled remote, so when we rescan the modified store also ensure the flag
state is still correct.

Fixes https://github.com/hughsie/fwupd/issues/363
2018-01-12 15:04:21 +00:00
Richard Hughes
80b79bb9aa trivial: Allow plugins to add metadata to the uploaded reports 2018-01-11 21:28:22 +00:00
Richard Hughes
473c520e38 Add in extra metadata to the uploaded reports
Save the dependency versions, architecture and the kernel versions in the
history database as metadata as it may be different to the time of upload.
2018-01-11 21:28:22 +00:00
Richard Hughes
611f1a9cbf Set the remote-id on devices returned by GetHistory 2018-01-11 20:19:41 +00:00
Richard Hughes
3eb2a00d10 trivial: Fix up the version check for offline firmware reporting 2018-01-11 20:19:16 +00:00
Richard Hughes
6b22295cf0 Add a D-Bus method to modify a historical device
This allows us to set specific flags on the device stored in the database.
2018-01-11 10:20:48 +00:00
Richard Hughes
a2f8e45c0f trivial: Set the update state for any updates that need a reboot
This has to be done at each engine startup, as this will happen on the *next*
OS boot.
2018-01-11 10:11:17 +00:00
Richard Hughes
476363ac19 Add a D-Bus method to get the history information 2018-01-11 10:08:58 +00:00
Richard Hughes
bc3a4e1f57 Store firmware update success and failure to a local database
Rename FuPending to FuHistory to better represent what the object is now doing.
Also, while we're here, switch to using SQLite prepared statements to avoid a
possible invalid read on i386 hardware.
2018-01-11 09:59:34 +00:00
Richard Hughes
74fa2ca635 Fix firmware downloading using gnome-software compiled against fwupd 1.0.x
Always set the AppStream app properties on the FwupdRelease. In some cases we
were returning FwupdRelease objects with no name or summary which gnome-software
was ignoring.
2018-01-10 21:37:43 +00:00
Richard Hughes
eafba48905 trivial: Namespace the ignored cleanup error better 2018-01-08 21:59:08 +00:00
Richard Hughes
9939f1c85c trivial: Fix tiny memory leak when getting GUIDs from an invalid archive 2018-01-08 16:56:19 +00:00
Richard Hughes
c7bbbc246b Allow specifying the maximum archive size in the daemon config 2018-01-03 07:38:27 +00:00
Richard Hughes
4f50e6268a Do not try to parse huge compressed archive files
We don't want to allow DoS-ing the daemon by trying to decompress a huge sparse
cabinet archive.
2018-01-03 07:38:27 +00:00
Richard Hughes
eec8a3c068 trivial: Fix a compile warning with the latest GLib 2018-01-02 20:37:31 +00:00
Richard Hughes
deea2da041 Use the new functionality in libgcab >= 1.0 to avoid writing temp files
Using old versions of gcab we could only do one thing: extract the files in the
cabinet archive to a new directory in /tmp, and then fwupd would have to read
them back in to memory to parse them. This was both inelegant and wasteful, and
probably not an awesome idea from a security or privacy point of view.

Using libgcab >= 1.0 we can decompress to a GBytes blob, and then verify the
firmware and metainfo file without anything being written to disk.

As this is a security sensitive operation, move the fwupd-specific helper code
out of libappstream-glib and also add a lot of internal self tests.

The gcab code will have to remain in libappstream-glib for a long time, but we
don't have to use it. Handling the cab file here also allows us to fix two
long-standing bugs:

 * MetaInfo or firmware files in a subdirectory are handled correctly

 * The archive can also be self-signed using PKCS7 instead of using GPG
2017-12-21 08:54:00 +00:00
Richard Hughes
650dadebe6 Choose the correct component from provides matches using requirements
In the case of multiple <component> sections with different AppStream IDs, but
with the same GUID <provides>, filter using the requirements rather than just
choosing the first one.

This allows the update of Logitech devices with secure bootloaders. Many thanks
to Ogier Bouvier for identifying the problem.
2017-12-14 15:50:19 +00:00
Richard Hughes
fbcebe096b Connect the progress and status callbacks on the new FuDevice on replug
This ensures we get progress events when replugging a device. Also, remove the
callbacks on the 'old' device to avoid causing multiple events on a 2nd-replug.
2017-12-11 16:48:56 +00: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
c3476d56de Add a method to probe a FuUsbDevice before it is opened
This allows us to further clean up device creation.
2017-11-30 14:16:34 +00:00
Richard Hughes
df149ac006 Remove the superfluous check for a duplicate FuDevice addition 2017-11-29 15:56:29 +00:00
Richard Hughes
634e9228f8 Always show coldplugged USB devices
When adding GUsbDevice we didn't account for coldplugging devices using the
GUsbContext enumeration.
2017-11-29 15:50:08 +00:00
Richard Hughes
f77d706fff trivial: Add some more profiling to narrow down a slow boot issue 2017-11-27 18:07:53 +00:00
Richard Hughes
5b5e945b18 trivial: Fix the prefix of profiling statements 2017-11-27 18:07:53 +00:00
Richard Hughes
5f733f2581 Fix critical warning when more than one remote fails to load
See https://github.com/hughsie/fwupd/issues/318
2017-11-26 16:14:20 +00:00
Richard Hughes
88adcbe601 Show a nicer error message if the requirement fails
`Not compatible with fwupd version 1.0.2, requires >= 1.0.3`

...is easier to understand than...

`Value of org.freedesktop.fwupd incorrect: failed predicate [1.0.3 ge 1.0.2]`
2017-11-24 16:37:15 +00:00
Richard Hughes
104f651132 Add a fu_plugin_usb_device_added() dedicated vfunc
This saves all the USB plugins from connecting to the context and managing the
device lifecycle and allows devices that uses FuUsbDevice to be removed
automatically.

This makes supported plugins *much* smaller indeed.
2017-11-24 16:13:44 +00:00
Richard Hughes
70425fe923 Allow different plugins to claim the same device
When changing from runtime->bootloader->runtime the usual way of handling this
in a fwupd plugin is to:

* reset the device and wait for a replug
* flash the hardware
* reset the device and wait for a replug

This works well when the runtime and bootloader modes are handled by the same
plugin. For situations like the Nitrokey device, where one plugin handles the
runtime (nitrokey), and another handles the bootloader (dfu) we have to have
the ability to 'ignore' the device removal and just issue a 'changed' signal
so the client refreshes the properties.
2017-11-24 14:42:27 +00:00
Richard Hughes
170c0c13c3 trivial: Route the ::added and ::removed through the FuDeviceList
This will allow the list to withhold events in the future, no functional changes now.
2017-11-24 14:42:27 +00:00
Richard Hughes
0a7e783cdd trivial: Move the device list to a new object
This moves more functionality out of the engine, and will allow us to add some
cleverness to the device list to allow the FuDevice to be shared between
different plugins.
2017-11-24 14:42:27 +00:00
Richard Hughes
e7e95452fd trivial: Move the plugin list to a new object
FuEngine is getting somewhat large and complicated, so split out as much plugin
list-specific functionality as possible
2017-11-24 14:42:27 +00:00
Richard Hughes
3483410076 Look up the FuPlugin from the FuDevice each time it is used 2017-11-24 14:42:27 +00:00
Richard Hughes
175635b916 trivial: Move assigning a GError for future code 2017-11-22 14:26:49 +00:00
Richard Hughes
e89ab5976f Partially revert the FuDevice weak reference detection
This causes problems for future patchsets that re-populate the FuDeviceItem.
2017-11-22 14:26:49 +00:00
Richard Hughes
43f9dd8c40 Sort the output of GetUpgrades correctly
This allows clients to just select the 'first' FwupdRelease for the newest if
there are multiple installable releases.

Fixes https://github.com/hughsie/fwupd/issues/319
2017-11-16 15:24:47 +00:00
Richard Hughes
b6f79556f1 Use a SHA1 hash for the internal DeviceID
It's actually less scary to see a SHA1 hash than it is to see a path like
/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.2. It's also way easier to
copy and paste into the various fwupdmgr command that require a device ID and
also means we can match a partial prefix much like git allows.

If we also move to a model where plugins can be changed during different stages
of the update (e.g. during detach) then the device might change connection type
and then the sysfs path not only becomes difficult to paste, but incorrect.

Session software doesn't care about the format of the device ID (it is supposed
to be an implementation detail) and so there's no API or ABI break here. A few
plugins also needed to be ported, but nothing too worrying.
2017-11-16 07:18:36 +00:00
Richard Hughes
0d7fdb3110 Split out the update detach and attach phases as explicit optional vfuncs
This allows us to do two things:

* Attach after a failed update, so the user isn't left with 'dead' hardware
* Split the detach and attach actions into different plugins in the future

This also allows us to have a separate vfunc to get the new version number
after flashing the firmware, as this may be handled in a different plugin to
the detach phase.
2017-11-14 10:49:43 +00:00
Richard Hughes
1cf88d6775 Detect if a plugin incorrectly unrefs the FuDevice
Watch the FuDevice in the FuDeviceItem with a weak reference and try to recover
without crashing the daemon if the plugin does the wrong thing.
2017-11-08 11:02:38 +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
74a80ccc50 dell: Use the new quirk infrastructure for version numbers 2017-11-02 19:08:51 +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
cc70f193e9 trivial: Use the new API in libappstream-glib directly 2017-10-09 21:00:26 +01:00
Richard Hughes
4eada34d4c trivial: Fix up introspection issues in the daemon code 2017-10-05 10:32:05 +01:00
Richard Hughes
642ec13754 trivial: Remove GetUpdates as it is no longer used 2017-09-28 09:23:52 +01:00
Richard Hughes
603e42d527 trivial: Include the releases as part of the device a{sv} array 2017-09-28 09:23:52 +01:00
Richard Hughes
80893e29fe trivial: Remove FwupdResult from libfwupd 2017-09-28 09:23:52 +01:00
Richard Hughes
07f963a52d trivial: Remove the deprecated fwupd_client_get_details()
Also, rename fwupd_client_get_details_local() to it's now-removed counterpart.
2017-09-28 09:23:52 +01:00
Richard Hughes
08a37992f9 Allow plugins to depend on each other
The only things that plugins can declare is that they should be run before,
after or never with regard to another plugin.
2017-09-21 17:09:06 +01:00
Richard Hughes
f2eccdee5c trivial: Fix a tiny memory leak when getting the upgrades list 2017-09-20 11:18:03 +01:00
Richard Hughes
10bd8ecfb8 trivial: Remove EnableOptionROM from daemon.conf
The exact same thing can be done using BlacklistPlugins=udev
2017-09-19 20:06:44 +01:00
Richard Hughes
b0aa379300 Use a fallback SYSCONFDIR if the default is not set 2017-09-19 20:06:44 +01:00
Richard Hughes
1354ea9cd8 Add fu_plugin_check_supported()
This allows a plugin to see if a GUID is supported in the AppStream metadata of
configured remotes. It allows plugins to skip devices that are not supported
and that do bad things when probed.
2017-09-19 16:00:45 +01:00
Richard Hughes
7769fb8da7 trivial: Add some more FuEngine self tests 2017-09-18 11:12:52 +01:00
Richard Hughes
c07ac39ad1 trivial: Return a better error for keyring set up failure 2017-09-17 09:33:53 +01:00
Richard Hughes
84bf038a52 trivial: Do not log to the journal when calling GetDetails 2017-09-16 18:52:51 +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
068d34307a Do not fail to load the daemon if cached metadata is invalid
Fixes: https://github.com/hughsie/fwupd/issues/257
2017-09-16 08:26:46 +01:00
Richard Hughes
93b1576bef trivial: Add helpers that can be used for returning local files
This also allows us to drop the use of FwupdResult in the daemon.
2017-09-15 14:12:18 +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
e7fd8eb81f trivial: Simplify the check for supported devices 2017-09-15 14:12:18 +01:00
Richard Hughes
a96413a368 Add a method to return a list of upgrades for a specific device 2017-09-15 14:12:18 +01:00
Richard Hughes
97284b1ad8 Move the downgrade calculation to the daemon 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
b3ca245b74 Move the release trust information to FwupdRelease
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 latter, as you could have a .cab file with multiple versions of the
firmware and only the first being signed.
2017-09-15 11:31:01 +01:00
Richard Hughes
d140210b4f trivial: Fix up the hex version numbers when adding to the store
This means we show the 'human readable' version numbers in the debug UI.
2017-09-14 10:26:15 +01:00
Richard Hughes
bd4d2856dd Merge releases where multiple remotes provide the same firmware
For a few months the lvfs-testing remote has not included firmware already
present in the stable lvfs remote. This means if you enable the testing remote
then components in the stable remote are not available to fwupd.

Instead of a simplistic check on the component ID, add the missing releases
no matter the ordering of the remotes.
2017-09-14 10:26:15 +01:00
Richard Hughes
fc0d170334 trivial: Show the available release versions in the daemon debug output
Also, truncate the output when there are lots of versions available.
2017-09-14 10:26:15 +01:00
Richard Hughes
225f3a98fe trivial: Sort the releases returned by GetReleases() 2017-09-13 19:38:51 +01:00
Richard Hughes
30dbf0d7d0 Remove the UniqueID property
This was only ever added for gnome-software, and is too inflexible for anything
else. It turns out we don't even need it in GNOME, as we can construct a
suitable ID ourselves using the existing values.

It was also ambiguous whether the unique ID was in reference to the device
or release -- and for gnome-software we need both.
2017-09-13 15:28:33 +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
d2b4fc5e00 trivial: Set the AppStream ID when returning results from GetReleases
We need this for GUI software.
2017-09-12 16:42:46 +01:00
Richard Hughes
a6bd5580d3 Add ModifyRemote as an easy way to enable and disable remotes like the LVFS
For example:

    $ fwupdmgr modify-remote lvfs-testing Enabled true
2017-09-07 23:02:58 +01:00
Richard Hughes
1941c44559 Do not auto-open all USB devices at startup
Fixes: https://github.com/hughsie/fwupd/issues/220
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
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
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
c6afb51e32 Add a FirmwareBaseURI parameter to the remote configs
This allows somebody to mirror the CDN without resigning the metadata files.

Fixes: https://github.com/hughsie/fwupd/issues/186
2017-08-23 14:22:12 +01:00
Richard Hughes
adcc16a53c trivial: Check for zero size firmware image 2017-08-21 12:26:46 +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
556ec355db trivial: Fix getting the keyring for PKCS7-enabled remotes
Found using Coverity, thanks.
2017-08-16 13:42:10 +01:00
Richard Hughes
99e621d388 Save the metadata signature in the local cache
This is useful if the admin wants to re-verify the metadata, or if a public
key is removed or expires.
2017-08-16 13:42:10 +01:00
Richard Hughes
b9ad09ca93 trivial: Correctly search for the .cab detached signature 2017-08-15 15:35: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
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
1ad45caeec Use new GUsb functionality to fix flashing Unifying devices
This avoids open()ing and close()ing multiple times on hotplug -- which in
itself isn't a huge problem as the requests are refcounted in libusb, but it
matters hugely when a plugin accidentally closes a device that was not opened.

As all the devices are going to be opened anyway (to read the vendor strings)
and the cost of keeping the device is open is tiny, just get libgusb to
auto-open *all* devices and keep them open for the duration.

Fixes: https://github.com/hughsie/fwupd/issues/155
2017-07-24 11:08:25 +01:00
Richard Hughes
535664cd1e Run the plugin coldplug methods in a predictable order
When reading with g_dir_read_name() the returned files do not have to be sorted
in any particular order and could even change between invokation. This patch
makes debugging the interactions between plugins much easier.
2017-07-24 10:32:06 +01:00
Mario Limonciello
c29b398ad0 trivial: fix various spelling errors 2017-07-17 13:07:05 -05:00
Mario Limonciello
5735fd67c1 trivial: set engine back to idle
A regression from 9945edbe74 causes
a missing newline for many actions because it doesn't go back to idle
2017-07-13 16:22:19 -05:00
Mario Limonciello
790701f32b trivial: adjust get-details and get-devices output Display Name output
This returns them back to the more readable 0.8.x behavior where
devices have the name first and then all the details indented.
2017-07-13 16:22:19 -05:00
Richard Hughes
32684f2344 Check all the device GUIDs against the blacklist when added
To the user it's not obvious which is the default GUID.

See https://github.com/hughsie/fwupd/issues/127
2017-07-13 09:32:26 +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
Richard Hughes
ed34991bd8 Do not unlock devices when doing VerifyUpdate
We used to do this dance to avoid reading the Option ROM on hardware by default
(some faulty hardware would crash...) but now we're doing the verify update in
the daemon there's no need to split this into two steps.

Fixes: https://github.com/hughsie/fwupd/issues/149
2017-06-22 10:37:10 +01:00
Richard Hughes
b9bddfd7ac trivial: Ensure the verify component is replaced on veriy-update, not merged 2017-06-22 10:34:18 +01:00
Richard Hughes
08f12de44c trivial: Avoid warning when doing verify-update multiple times
Applications always need a valid source with newer appstream-glib versions;
even in this case where the source is the hardware itself.
2017-06-22 10:33:32 +01:00
Richard Hughes
22c88de8e4 trivial: Increase the warning level when a plugin adds a device twice 2017-06-22 09:36:32 +01:00
Richard Hughes
943d2c9bb5 trivial: Split out some common functionality from fu-engine.c 2017-06-21 09:04:39 +01:00
Richard Hughes
a5bb4d8428 trivial: Fix a missing signal causing a warning in the recent refactor 2017-06-19 20:22:25 +01:00
Richard Hughes
9945edbe74 Split up the daemon into the loader and an engine object
The idea here is that we move a lot of the 'meat' out of fu-main into the
engine. This also lets us simplify a lot of things and ensures the user
authentication is simple and easy to audit.
2017-06-19 13:50:38 +01:00