Commit Graph

61 Commits

Author SHA1 Message Date
Richard Hughes
6de10e118c Allow downloading firmware from IPFS
Only a small amount of the firmware on the LVFS will be available. The user
can use --ipfs on the command line for testing, or change the system-wide
default in /etc/fwupd/daemon.conf.

The IPFS daemon and command line client will need to be installed manually.
2021-02-01 19:33:31 +00:00
Richard Hughes
633ff10772 libfwupd: Add fwupd_client_install_release2_async()
We forgot to include FwupdClientDownloadFlags when adding the original method
fwupd_client_install_release() -- and we want to use additional download flags
for operations in the future.
2021-01-26 18:01:33 +00:00
Richard Hughes
5c9b1fcc81 Only include the start year in the copyright header
The end year is legally and functionally redundant, and more importantly causes
cherry-pick conflicts when trying to maintain old branches. Use git for history.
2021-01-07 14:48:16 +00:00
Richard Hughes
7d5a4f391b libfwupd: Use G_GNUC_WARN_UNUSED_RESULT for methods that should be checked 2021-01-04 15:24:35 +00:00
Richard Hughes
95a5fb2e2f Allow setting the GMainContext when used for sync methods
Use the 'default' main context by default so that we still get the signals
delivered via g_object_notify() but allow the library user to specify an
alternate GMainContext as required.

Using g_main_context_push_thread_default() works for PackageKit as signals are
returned using g_signal_emit() which is synchronous, and so doesn't use the
main context at all.

Use the same style of API which we did for libgusb all those years ago instead.
2020-12-04 07:58:05 +00:00
Richard Hughes
eba28b6520 libfwupd: Add fwupd_client_get_user_agent()
If we set a property, we should probably have a way to read it back...
2020-11-17 21:10:10 +00:00
Richard Hughes
7bcb8d4385 Export FwupdPlugin so we can convey enumerated system errors to the end user
For instance, we can tell the user that UEFI UpdateCapsule is disabled in the
system firmware, or that efivarfs is not mounted. This is much better than
creating "dummy" devices which are really just hacks around the problem because
no better API existed. THe dummy devices cause as many problems as they solve.

Plugins have to set FWUPD_PLUGIN_FLAG_USER_WARNING if a warning should be shown
to the user, and only one warning will be shown of each failure type.

It is expected that GUI clients like gnome-software and gnome-firmware would use
this API to notify the user the localized message for why firmware updates are
not being shown.

Fixes https://github.com/fwupd/fwupd/issues/2456
2020-10-13 15:56:49 +01:00
Richard Hughes
7c8a830659 libfwupd: Add async versions of the library for GUI tools
Rather than force the GUI to interact with fwupd using threads, provide
async versions so thay can be run without blocking the UI thread.
2020-09-03 15:46:57 +01:00
Richard Hughes
93ba041ce2 trivial: Use @self in FwupdClient to modernize the object 2020-08-27 08:03:16 +01:00
Richard Hughes
3120683143 Allow blocking specific firmware releases by checksum
Fixes https://github.com/fwupd/fwupd/issues/2280
2020-08-10 17:14:15 +01:00
Richard Hughes
a99b5adfb6 trivial: Export fwupd_client_ensure_networking()
This is required when the calling application needs the low-level soup-session
with the user agent set correctly rather than using the helper methods like
fwupd_client_download_bytes().

This is what GNOME Software needs to handle the GsApp progress completion.
2020-07-23 13:00:39 +01:00
Richard Hughes
f4c55d888e libfwupd: Add fwupd_client_install_release()
This allows us to remove a lot of copy-and-paste code in GNOME Software.
2020-07-09 20:57:00 +01:00
Richard Hughes
02d94d3139 libfwupd: Add fwupd_client_install_bytes()
Sometimes you do not have a filename and just a blob of memory.
2020-07-09 20:57:00 +01:00
Richard Hughes
d528571971 libfwupd: Add fwupd_client_refresh_remote()
This takes care of downloading the correct files and allows remotes to be
refreshed from other CLI and GUI tools without copying large chunks of code.

This also allows us to download the metadata without writing two temp files
to the users cache directory. Although not security sensitive, it's probably
not a good idea if we can avoid it.
2020-07-09 20:57:00 +01:00
Richard Hughes
71ba813a71 libfwupd: Add fwupd_client_update_metadata_bytes()
Sometimes the data is coming from a blob of memory and not a cached file, so
use a memfd to create a file descriptor that can be passed to the daemon.
2020-07-09 20:57:00 +01:00
Richard Hughes
9b6d616383 fwupd: Export fwupd_client_download_bytes() into the client library
The logic here is that we can use one central session for all client actions.

Also, set the user agent for the *runtime* version of fwupd -- it's the runtime
version we use when checking capabilities, rather than the built-against
version. This would also explain why there are so many very obsolete versions
of fwupd being recorded on the LVFS...
2020-07-08 19:00:42 +01:00
Richard Hughes
df89cd566e Allow firmware to require specific features from front-end clients
At the moment we just blindly assume the capabilities of the front-end client
when installing firmware. We can somewhat work around by requiring a new enough
fwupd daemon version, but the client software may be older or just incomplete.

This would allow, for instance, the firmware to specify that it requries the
client to be able to show a detach image. This would not be set by a command
line tool using FwupdClient, but would be set by a GUI client that is capable
of downloading a URL and showing a PNG image.

Clients that do not register features are assumed to be dumb.
2020-06-27 15:43:57 +01:00
Richard Hughes
6ecc4ca144 Export the report metadata on the D-Bus interface
This allows the client to easily query metadata to upload with the report,
without exporting rarely used attributes as D-Bus properties on the interface.

It also allows us to add extra metadata values in the future without changing
the public API.
2020-05-20 19:47:53 +01:00
Richard Hughes
0c6efe2e04 Revert "Export the host vendor, family and SKU"
This reverts commit 81c371098c.
2020-05-20 19:47:53 +01:00
Richard Hughes
81c371098c Export the host vendor, family and SKU
The 'product name' is not typically what the hardware is known as. We need the
vendor, family and SKU if the user is going to recognise the hardware.
2020-05-19 19:42:45 +01:00
Richard Hughes
196c6c69db Add support for the Host Security ID
The HSI specification assigns a simple text ID to the current state of firmware
security. As new vulnerabilities are found, and as protection measures are
updated, new requirements will be added to the required firmware behaviours for
each HSI value.

The HSI specification is currently incomplete and in active development, and
so the --force flag is required in all command line tools. The current ID value
will probably change on a given platform so please do not start using the result
for any kind of compliance requirements.
2020-05-11 22:11:49 +01:00
Richard Hughes
3aaf53c6f0 Allow specifying the device on the command line by GUID
The GUID is the only stable identifier, and allowing using the GUID makes it
much easier to test specific devices.
2020-04-20 18:45:45 +01:00
Mario Limonciello
eb4c76416c Add a new property Interactive to the daemon
Clients can use this as a hint whether the daemon is running on
a terminal.

`fwupdmgr` uses this to bypass the systemd service check.
2019-11-11 11:16:21 -06:00
Richard Hughes
0917fb6aec Export the salted machine ID as a daemon property 2019-09-23 17:34:47 +01: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
bfcf75b7a6 Allow fwupdmgr to modify the daemon config
This allows several things, for instance:

 * Adding or removing blacklisted plugins or devices
 * Changing the idle timeout where allowed

...without a user needing to manually modify a configuration file.
2019-04-17 12:12:13 -04:00
Richard Hughes
3d60762bed Add a D-Bus method to generate a signature using the self-signed client certificate 2019-03-11 13:57:39 +00:00
Richard Hughes
8dd4c1c4dd Allow restricting firmware updates for enterprise use 2019-03-05 19:05:07 +00:00
Mario Limonciello
96a0dd5606 Add a support for delayed activation
This is intended for devices that it is not safe to immediately activate
the firmware.  It may be called at a more convenient time instead.

Both fwupdmgr and fwupdtool support the feature.

- if called at runtime with fwupdmgr it uses the daemon
- during shutdown fwupdtool uses the pending.db to perform this feature.
2019-02-27 09:04:54 +00:00
Richard Hughes
bfd946e463 Use '#pragma once' to avoid a lot of boilerplate 2019-02-09 08:42:30 -06: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
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
51308e648a Adjust all licensing to LGPL 2.1+ (Closes: #526) 2018-05-29 09:03:13 +01: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
476363ac19 Add a D-Bus method to get the history information 2018-01-11 10:08:58 +00:00
Richard Hughes
642ec13754 trivial: Remove GetUpdates as it is no longer used 2017-09-28 09:23:52 +01:00
Richard Hughes
7965721015 trivial: Restore a sensible amount of padding in the FwupdClientClass
We broke API recently, we might as well go full throttle.
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
ba73c76d69 trivial: Remove the deprecated fwupd_client_update_metadata()
Also, rename fwupd_client_update_metadata_with_id() to it's now-removed counterpart.
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
eb94c14022 trivial: Remove the deprecated fwupd_client_get_devices()
Also, rename fwupd_client_get_devices_simple() to it's now-removed counterpart.
2017-09-28 09:23:52 +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
b4fd0dfd7d Move deprecated symbols to a new header
This does two things:

 * Allows new users of the library to see only the supported symbols
 * Allows us to ensure we're not using deprecated API internally

I can also use this in gnome-software in CI to make sure we're not using
deprecated API too. I don't think we're ready for a soname bump so we have to
hang on to the deprecated code for now.
2017-09-08 13:31:01 +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
89483f1bb9 Add --version option to fwupdmgr
$ fwupdmgr --version
    client version:	0.9.6
    daemon version:	0.9.6

Fixes https://github.com/hughsie/fwupd/issues/153
2017-07-04 20:49:27 +01:00
Richard Hughes
0a87f6fb03 Store the metadata files rather than merging to one store
Now we have multiple remotes that can be enabled or changed at runtime we need
to do several things better:

* Only load components from remotes that are enabled

* Only load a component if a higher priority remote has not already added it

Rather than just appending all recieved metadata into one big XML file, save
the original metadata .xml.gz files in /var/lib/fwupd/remotes.d and only load
them in the correct priority order if the remote is known and enabled.

Remove the old /var/cache/app-info/xmls/fwupd.xml file, also noting it wasn't
really a cache file at all but actually something quite important.
2017-06-16 16:43:13 +01:00
Richard Hughes
81c7649dd8 libfwupd: Add fwupd_client_get_devices_simple() to return us an array of devices, not results 2017-06-06 11:10:57 +01:00
Richard Hughes
45c1545b0a Add a 'downgrade' command to fwupdmgr
This allows the user to downgrade the firmware on a device.
2017-06-06 09:44:47 +01:00
Richard Hughes
e4a100cfee Add a GetReleases() D-Bus call to return all releases for a device
This allows us to downgrade firmware in the future.
2017-06-05 17:42:57 +01:00