Commit Graph

171 Commits

Author SHA1 Message Date
Richard Hughes
3e0a4dc1c3 Be smarter and include less header files per source file 2022-06-14 14:36:52 -05:00
Richard Hughes
ac03f02f4c trivial: gi-docgenize some of the function comments 2022-06-11 21:26:46 +01:00
Richard Hughes
c9dd8cb256 trivial: Make the FwupdClient host properties RW
We'll need this for future functionality when using client in fwupdtool.
2022-05-18 15:03:00 -05:00
Richard Hughes
91f23d67ab Export the system battery levels on the D-Bus interface 2022-05-18 07:16:07 +01:00
Richard Hughes
7b806dbb2a Pass the socket address when setting up the daemon 2022-05-14 20:47:50 +01:00
Richard Hughes
a489ec13bb trivial: Automatically set the socket address on Windows 2022-05-11 10:11:06 -05:00
Richard Hughes
418d883ea7 Allow specifying a non-file D-Bus transport
e.g. on Windows you can do:

    FWUPD_DBUS_SOCKET=tcp:host=localhost,port=12345
2022-05-11 10:11:06 -05:00
Richard Hughes
c56e0ba4cc Use the native CA store on Windows when possible 2022-05-10 13:09:44 +01:00
Richard Hughes
47f887f100 trivial: Do not connect the daemon to download files
There's nothing we need as all the useragent data is client-side.
2022-05-10 12:56:43 +01:00
Richard Hughes
31907e6863 Add a sanity check when trying to refresh a non-download remote 2022-04-25 15:47:20 +01:00
Richard Hughes
3b0d1a6c6b trivial: Ignore the return value of curl_easy_setopt() in most cases
This makes Coverity happy.
2022-04-13 15:08:12 +01:00
Richard Hughes
dd3fc46786 trivial: Add some missing g_return_val_if_fail() calls 2022-03-29 20:04:26 +01:00
Richard Hughes
ce762c1d08 trivial: Use the correct struct offset for device requests 2022-03-28 15:08:16 +01:00
Richard Hughes
d3cba9a679 Add fwupd_client_disconnect() for future usage 2022-03-11 13:28:00 +00:00
Crag Wang
a2b46e15cf Add daemon configuration 'OnlyTrusted' to D-Bus properties 2022-03-10 09:46:54 +00:00
Richard Hughes
4ce9972ce5 trivial: Don't leak the string even on critical failure
Not totally sure this is worthwhile, but it triggered a failure in the
RHEL tests we do - and it's less work to fix it than argue.
2022-03-08 16:01:16 +00:00
Richard Hughes
bb1bcce863 Allow fwupd to operate without a D-Bus daemon
This adds support for optionally using a UNIX domain socket where a
D-Bus daemon may not be running.

To use this, launch the daemon and clients with something like
`FWUPD_DBUS_SOCKET=/var/run/fwupd.sock fwupdmgr get-devices`
2022-01-31 14:05:23 +00:00
Richard Hughes
c725e42e34 trivial: Fix various const issues 2022-01-03 22:46:23 +00:00
Richard Hughes
e17a107ce1 trivial: Cast the g_signal_connect() object to allow static analysis
This is useful when using https://gitlab.freedesktop.org/tartan/tartan
2022-01-03 22:46:23 +00:00
Richard Hughes
c4590f2f25 trivial: Add some missing g_return_val_if_fail() calls 2022-01-03 22:46:23 +00:00
Richard Hughes
2e99055d1e trivial: Add some more annotations for language bindings 2022-01-03 22:46:23 +00:00
Richard Hughes
3822422b1e trivial: Workaround two false 'unused' warnings from clang 2021-12-10 16:00:07 +00:00
Richard Hughes
beb29ff698 Add a sync-bkc subcommand to ensure a known set of firmware versions
Install or downgrade firmware on all devices to make the system match
a well known set. This allows two things:

 * Factory recovery where a device in the field has been upgraded
 * Ensuring a consistent set of tested firmware for a specific workload

A tag is assigned either during upload or added post-upload on the LVFS
which is included in the metadata. A single firmware can be marked with
multiple tags, and tags can be duplicated for different firmwares.
2021-11-29 15:16:14 +00:00
Richard Hughes
6e651269ba Fix running the tests when fwupd is not installed
This probably regressed in 70f9124545 as
the callers actually expect an error in the GDBusError domain, rather
than one fixed up in the FwupdError domain.

Fixes https://github.com/fwupd/fwupd/issues/4014
2021-11-23 15:18:41 +00:00
Richard Hughes
b87a909223 trivial: Do not show a critical warning is LANG is unset 2021-11-12 15:26:31 +00:00
Richard Hughes
4d63d4ad7c Use g_subprocess_communicate() to fix IPFS downloads
Since switching to a custom GMainContext we broke reading the stream of
the GSubprocess.
2021-11-09 09:22:18 +00:00
Richard Hughes
09b946cb40 trivial: Fix ctrl+c when downloading with IPFS 2021-11-09 09:22:18 +00:00
Richard Hughes
a0cb743700 Show changes in HSI attributes when required
e.g. `fwupdmgr security --force` would display:

    Host Security Events
      2021-10-29 10:51:42:  ✘ Kernel lockdown disabled
      2021-10-29 10:51:42:  ✘ SecureBoot disabled
      2021-10-29 09:32:32:  ✔ IOMMU device protection enabled
      2021-10-29 09:28:52:  ✘ IOMMU device protection disabled
2021-11-01 06:58:44 +00:00
Richard Hughes
70f9124545 Show translated firmware release notes when provided
Send the users locale to the daemon so that it can be used to prefer
the localized update text over the default en_US version.

    $ LANG=fr_FR.UTF8 fwupdmgr get-details test.cab
    ...
    └─ACME Plan 9:
          Nouvelle version: 0.0.5
          Licence:          Propriétaire
          Urgence:          Faible
          Fournisseur:      ACME Ltd.
          Description:      Cette version stable corrige des bugs.

I decided to send the locale to the daemon rather than change the
`Description` to return GVariant to `a{ss}` as we also probably want
to support things like localized summary and URLs too in the future.
2021-10-24 18:59:15 +01:00
Richard Hughes
bc14f4c59c Support client-side abbreviated hashes
This allows the user to do something like `fwupdmgr get-releases a12d`
which is already supported daemon-side.
2021-10-18 11:16:45 +01:00
Richard Hughes
0fb485e434 Raise the client timeout value from 25 seconds
When coldplugging expensive servers with a huge number of Redfish
devices it takes about 30 seconds to start fwupd while we wait for the
BMC to return results.
2021-10-08 17:22:45 +01:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Richard Hughes
3d6a48fad3 Do not save invalid files on LVFS server error
In the event of a 429 response libcurl does not fail curl_easy_perform()
and instead saves the 'Too Many Requests' string as the payload.
This obviously fails the cabinet checksum specified in the metadata.

Move the response code checks to the success branch and also add checks
for the other 4xx and 5xx errors.

Fixes the fwupd half of https://github.com/fwupd/firmware-lenovo-thinkpad/issues/137
2021-07-27 15:59:17 +01:00
Richard Hughes
19abf996c7 Allow the daemon to request interactive action from the end user
The "return error and hope the client resubmits the firmware again"
pattern is clunky. There are two plugins doing this now, and about to
be one more.

This adds FwupdRequest which provides a structured way of asking the
user to perform an action, e.g. to replug the device or to press a
special key or button.

This replaces much of the UpdateMessage and UpdateImage API although
it is still used internally. Clients capable of processing the new
DeviceRequest signal should add REQUESTS to their feature flags.

Also, this allows us go back to the old meaning of _NEEDS_BOOTLOADER,
which was "needs rebooting into a bootloader mode" rather than the
slightly weird "user needs to do something and resubmit request".
2021-07-14 17:03:50 +01:00
Richard Hughes
a02c1073f2 trivial: Fix up some of the developer docs
And add some missing content as requried.
2021-06-11 09:39:03 +01:00
Mario Limonciello
1e17457b16 Allow building the documentation with gi-docgen and gtk-doc
Until gi-docgen is declared stable support either of them.
This effectively means that hand builds and CI builds will use
gi-docgen, but distro builds use gtk-doc-tools.
2021-06-09 22:21:53 +01:00
Richard Hughes
0aaf060105 Follow HTTP 3XX redirects when downloading files
This allows us to punt some smaller files onto the CDN.
2021-05-14 18:48:47 +01:00
Richard Hughes
20ef071b3c trivial: Style fixes to lots of gtk-doc 2021-05-10 14:35:10 +01:00
Richard Hughes
76cafb29b7 Fix a critical warning when downloading files
The call to g_proxy_resolver_get_default() is (transfer none) and so unref'ing
it causes GLib to get very upset. Also, move it to be per-FwupdClient rather
than per-request as it can be expensive to call in the PAC-runner case.
2021-04-30 11:19:09 +01:00
Richard Hughes
89d45a0d91 trivial: Standardize on introspection for @error and @cancellable
Also standarize on `Returns:` for the result.
2021-04-28 16:19:50 +01:00
Richard Hughes
fdd507957a Switch from libproxy to GProxyResolver
GProxyResolver will use libproxy only when required. TIL.
2021-04-28 15:52:45 +01:00
Richard Hughes
f992fb75cd Use libproxy to get the system proxy setting for a given URL 2021-04-26 16:30:13 +01:00
Richard Hughes
a5966f7085 trivial: Codespell fixes 2021-03-19 16:42:33 +00:00
Richard Hughes
4d7bcaace5 trivial: Fix warning when compiling without libcurl 2021-02-08 12:53:12 +00:00
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
7715dead97 trivial: Fix bogus -Wunused-variable warning 2021-01-30 15:49:20 +00:00
Richard Hughes
382524d82f trivial: Fix potential crash when doing crazy things
Fix the asan crash when feeding the value back into itself, e.g

    fu_firmware_set_version (firmware, fu_firmware_get_version (firmware));
2021-01-28 14:13:59 +00:00
Richard Hughes
e1abefb788 trivial: Use fwupd_client_download_bytes2_async() when installing releases 2021-01-26 20:32:32 +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
ddeceb419f Allow allow downloading from a list of possible URLs 2021-01-26 18:01:09 +00:00