Commit Graph

124 Commits

Author SHA1 Message Date
Richard Hughes
110ef12cc7 Add a device problem for 'update-in-progress'
We already had this as an inhibit, but this was not translated client-side.

We also need to propagate the problem to the bootloader device if the device
replugs during firmware update.
2023-01-26 09:01:26 +00:00
Richard Hughes
ddd5140832 trivial: Fix tests to include 'emulated' 2023-01-24 15:41:01 +00:00
Richard Hughes
a6deceda32 Allow desktop software to inhibit the system to prevent all updates
On edge hardware a process may want to disable firmware updates as it might be
a bad time to allow an upgrade.
2023-01-23 13:14:23 +00:00
Richard Hughes
b9837e4140 trivial: Actually make the self test match the comment 2022-12-15 17:27:22 +00:00
Richard Hughes
3a8824d4e7 Add FwupdReport to expose the signed reports from QA teams
Some front end clients are going to be allow-listing updates based on what
the release was tested on, or by who the testing team was.

Export this data from each report when requested.
2022-11-29 16:55:55 +00:00
Richard Hughes
40d02f3ae1 Add fwupd_release_incorporate() for future usage 2022-11-29 09:01:58 +00:00
Richard Hughes
44f816e1c6 trivial: Fix invalid self test loop
Spotted by Coverity.
2022-11-03 23:51:00 -05:00
Richard Hughes
1e7d741601 Check system integrity when installing UEFI updates
Recently we had an update that changed the system-defined Platform Key, and
we've certainly had updates in the past that changed the Boot#### variables.

Store some core ACPI and UEFI system integrity state from before and after the
update which can be used to mark (waivable) test failures on the LVFS.
2022-11-03 15:51:10 +00:00
Richard Hughes
1c3c5d9892 Allow optionally translating request messages
Also add two more request IDs to make these specific enough to be useful.
2022-10-03 20:54:24 +01:00
Richard Hughes
bd5f13f938 Add FwupdRequestFlags for future usage 2022-10-03 18:04:15 +01:00
Richard Hughes
99e9e5d523 Allow compiling plugin as built-in GObjects
Allow plugins to be built into libfwupdpluginbuiltin.so and created via GType.
2022-09-28 12:52:00 +01:00
Richard Hughes
3195a57485 trivial: Always use g_assert_no_error() first
It's way more helpful to print the GError message than just an boolean failure.
2022-09-27 12:10:07 +01:00
Mario Limonciello
7be0c033a9 trivial: skip self tests for fwupd_client_remotes_func if G_DBUS_ERROR_NAME_HAS_NO_OWNER
Fixes: #5073
2022-09-23 07:52:39 -05:00
Richard Hughes
c73a55faa1 Remove a potential foot-gun when saving config values
If a specific plugin calls fu_plugin_set_secure_config_value() and then
fu_plugin_set_config_value() then we'll save the file with the world-readable
permissions.

Set a plugin flag to say that 'this plugin is storing sensitive details' which
allows us to use the same entrypoint and also fix up any files at startup that
do not have the correct permissions.
2022-09-22 14:47:12 +01:00
Richard Hughes
6bb1b1c81f trivial: Fix a BIOS setting self test value
PVS: The 'ret' variable is assigned but is not used by the end of the function.
2022-09-09 19:23:29 +01:00
Mario Limonciello
9549970285 trivial: bios-settings: shuffle the json output order
We want the name and description to be the first few keys
2022-08-24 07:20:01 -05:00
Mario Limonciello
b7b0ce533d trivial: Unify ambiguity between bios-attrs and bios-settings
These are currently used interchangeably since there was indecisiveness
which to use as the feature was being developed.

As outward facing it will be named with "settings", change all uses
in the code to match this.
2022-08-24 07:20:01 -05:00
Mario Limonciello
2536bf462c Allow running get-bios-settings without root or PK
The only information that is secret is the `current_value`.
Augment the d-bus call to determine whether the caller needs this
information.

* If `fwupdmgr` is launched as root it will be provided.
* If `fwupdmgr` is launched with `--authenticate` it will be requested
  and PK will be engaged.
2022-08-11 09:52:26 -05:00
Mario Limonciello
5ded4f44fe Add support for reading and writing firmware attributes
This support is comprehensive:
 * Client library support
 * Daemon support
 * plugin support
 * Client tool support (with new commands)
2022-07-28 17:30:57 -05:00
Richard Hughes
62fc515714 Allow loading in emulated host profiles for debugging
This allows us to load sets of different host security attributes
for testing the various front end tools we have now. e.g.

    sudo FWUPD_HOST_EMULATE=thinkpad-p1-iommu.json.gz fwupd

or, using a non-compressed absolute path:

    sudo FWUPD_HOST_EMULATE=/tmp/test/thinkpad-p1-iommu.json fwupd

Data can be created with `./contrib/generate-emulation.py file.json`
and then can be manually modified if required. Running the script on
a file that already exists will just strip out any unneeded data, as
well as piping content into it using stdin.

As a precaution, the org.fwupd.hsi.HostEmulation attribute is added
so we do not ask the user to upload the HSI report. It also allows
the LVFS to ignore any HSI reports with this attribute for clients
that upload HSI reports regardless.

See https://github.com/fwupd/fwupd/discussions/4832
2022-07-18 16:27:59 +01:00
Richard Hughes
7566e56fb5 Add fwupd_device_from_json() for future use 2022-07-18 16:27:59 +01:00
Richard Hughes
26e5ecb567 trivial: Add fwupd_security_attr_remove_flag() for future use 2022-07-14 14:48:51 +01:00
Richard Hughes
5cf63a0741 trivial: Add some more coverage tests for FwupdRelease 2022-07-01 13:57:18 +01:00
Richard Hughes
5971783634 trivial: Add a missing FwupdDeviceFlags string converter 2022-07-01 13:57:18 +01:00
Richard Hughes
6243e9f62a Add some coverage tests for FwupdRemote 2022-07-01 13:57:18 +01:00
Richard Hughes
358b1e0229 trivial: Add some more tests for FwupdPlugin 2022-07-01 11:25:26 +01:00
Richard Hughes
b1a31dbfae Include the plugin name in the FwupdSecurityAttr GVariant 2022-07-01 10:55:56 +01:00
Richard Hughes
2dc029aa6a Fix setting the device ID on the FwupdRequest 2022-07-01 10:55:56 +01:00
Richard Hughes
b2284bf99e Increase the coverage of the self tests 2022-07-01 10:55:56 +01:00
Gaël PORTAY
9b969de718 Save serial number and instance-ids when trusted
See commit e3016602f8.
2022-06-20 12:57:40 -04:00
Richard Hughes
8b3f7a1a52 trivial: Add some self tests for fwupd_device_incorporate()
This was based on a hunch that was proved wrong, but the tests still
seem useful anyway.
2022-06-14 21:01:57 +01:00
Richard Hughes
3e0a4dc1c3 Be smarter and include less header files per source file 2022-06-14 14:36:52 -05:00
Richard Hughes
8ebad4ea75 Specify an enumerated problem when inhibiting devices
This allows us to make smarter policy decisions in the future on when
to show unavailable updates. It also means we can show translated
text in the frond-end clients.

Only problems the user can "fix" are enumerated. For example, opening
the laptop lid, or charging the device battery.
2022-05-19 13:09:03 -05:00
Richard Hughes
0b7af7d54b trivial: Ignore the return value of setenv() in most cases
This makes Coverity happy.
2022-04-13 15:08:12 +01:00
Richard Hughes
cb110b55f8 trivial: Fix regression from 9f94dc9 on Ubuntu Focal 2021-12-17 12:19:39 +00:00
Richard Hughes
4fe8a36729 Add support for LVFS component tags
These allow us to tag components as being part of a set, e.g. a BKC.
2021-11-25 10:36:26 +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
60612294f5 trivial: Use the device GType as the debugging root
We never show the fu_device_to_string() output to the user in normal
circumstances, and it's super useful for it to match the FuFirmware
format.
2021-11-15 14:59:52 +00:00
Richard Hughes
5e895b89c9 Use pre-computed namespace GUIDs to load 0.3% faster
This should also help memory fragmentation at startup too as we were
splitting a lot of very small strings.
2021-11-03 21:51:45 +00:00
Richard Hughes
81d0216d14 trivial: Make checking a GUID faster to speed up startup by 0.23%
We call this 570 times at startup, and it makes up a non-trivial amount
of the daemon startup time...
2021-11-03 21:51:45 +00:00
Richard Hughes
a085b4dd68 Add a 'created' property on the HSI security attribute 2021-10-28 17:25:40 +01:00
Richard Hughes
dbdd3740a3 Add support for loading the HSI result from a JSON blob
This is how we save it to the database, and we'll need to load old
records for future functionality.
2021-10-28 15:36:13 +01:00
Richard Hughes
2d00cda464 Remove PLUGINBUILDDIR and use G_TEST_SRCDIR and G_TEST_BUILDDIR instead
This allows us to override the location we load data files from, which
allows us to do more kinds of installed tests in the future.

Also, move the global data/tests content into the place that it is used
as it was getting impossible to manage.
2021-10-21 18:36:22 +01:00
Richard Hughes
478e44bc19 trivial: Do not use g_assert() in self test code
Note that g_assert() should not be used in unit tests, since it is a
no-op when compiling with G_DISABLE_ASSERT. Use g_assert() in production
code, and g_assert_true() in unit tests.

See https://github.com/fwupd/fwupd/issues/3790
2021-09-24 22:20:21 +01:00
Richard Hughes
494fd2736f Allow installing the LVFS remote, but disabled
This is a patch that I have to regenerate almost every rebase. Just
move it upstream as it's probably not RHEL specific.
2021-09-24 16:55:04 +01:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Richard Hughes
a65f5759ef trivial: Fix a typo of fwupd itself 2021-07-15 09:33:25 +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
f34c5d4eb6 trivial: Print the GUIDs in the order they were added
This fixes the self tests on old GLib versions as the order of the
GHashTableIter is not guaranteed to be stable.
2021-07-09 15:43:45 +01:00
Richard Hughes
eb8e43d942 libfwupd: Show unconverted GUIDs when debugging
Add a suffix to any GUIDs that are currently unconverted InstanceIDs.

This makes plugin development much easier as you can now see why GUID
quirks in the subclassed ->setup() are not matching.
2021-06-17 16:22:06 +01:00