Commit Graph

6025 Commits

Author SHA1 Message Date
Richard Hughes
affd39f10b Change the style guide to no space before the bracket 2021-07-24 20:56:26 -05:00
Richard Hughes
a75266e701 trivial: Add the missing unversioned clang-format-diff 2021-07-24 16:38:04 +01:00
Richard Hughes
2a78d6d520 trivial: Order the headers in a more normal way 2021-07-24 16:11:57 +01:00
Richard Hughes
b7627e30a7 Set the column limit to 100 chars
80 is just too small on a modern editor, even in portrait mode.
2021-07-24 16:11:57 +01:00
Daniel Campello
af1577342a reformat-code.py: add argumentless mode for formatting diffs 2021-07-23 12:41:22 -06:00
Richard Hughes
dfdecb304c amt: trivial: Fix another critical warning about missing context 2021-07-23 13:57:11 +01:00
Richard Hughes
0efa97229a Automatically clear the update error as required
This is less fragile than patching all the callers.
2021-07-23 13:16:47 +01:00
Richard Hughes
25c93aa7ca redfish: Identify hardware that needs to be updated to the same version
For instance, the EFI driver for a given network card cannot be
different for identical hardware.
2021-07-23 13:16:47 +01:00
Richard Hughes
a8206b2bf6 redfish: Work around a XCC-ism on Lenovo hardware
Only the backup BMC device (which we ignore anyway...) can be updated
by specifying the target ID, the others need an *empty* array so that
XCC can work out what devices need to be processed.
2021-07-23 13:16:47 +01:00
Richard Hughes
90c42f84b3 ata: Ignore the virtual M.2 device
This is updated using Redfish anyway.
2021-07-23 13:16:47 +01:00
Richard Hughes
ae48e02ac2 Do not assume the metainfo file is NUL-terminated
This was only true by accident. We'll need another fix for the LVFS to
add the missing NUL to restore compatibility for older clients.

Fixes https://github.com/fwupd/fwupd/issues/3533
2021-07-23 11:58:56 +01:00
Richard Hughes
5a6dccfa69 trivial: Fix critical warning on 'fwupdtool get-details' 2021-07-23 11:38:02 +01:00
Peter Marheine
464425fb5c SMBIOS: try reading from /sys/class/dmi if direct access fails
The raw SMBIOS tables that Linux exposes in /sys/firmware/dmi
are restricted to being readable by root only. If running as
non-root access is still permitted by fields that have been
pre-parsed by the kernel in /sys/class/dmi, most of which are
world-readable. This allows the daemon to load most HWIDs even
if running as a non-root user, as is done on Chromium OS.
2021-07-23 09:46:45 +01:00
Daniil Lunev
dc483a5110 fu-engine: Preserve NEEDS_REBOOT on successful update
Currently the SUCCESS state overrides reboot-needed, thus making the
devices considered for successive git-upgrades within same boot. The
change preserves the REBOOT_NEEDED state. It also added a missed
'changed' signal, which otherwise would skip updating the persistent
state.

Change-Id: I6f60606f2253d89eab2f5bddceba19d19c4c9c97
2021-07-23 08:45:16 +01:00
George Popoola
f7195f0a22 powerd: Moving ignore power case before method call
This adds a condition that permits updates for devices that don't take
any power conditions into account.
2021-07-22 16:26:54 -06:00
George Popoola
1d8d26d167 powerd: Adding case for devices that ignore power
This adds a condition that permits updates for devices that don't take
any power conditions into account.
2021-07-22 20:57:32 +01:00
Daniel Campello
4b10b1324c trivial: powerd: reformat code with contrib/reformat-code.py 2021-07-22 10:45:45 -06:00
Daniel Campello
3da17e5fbb clang-format: adjust argument packing and consecutive declarations 2021-07-22 10:45:45 -06:00
George Popoola
8baa78b254 Addition of FWUPD_DEVICE_FLAG_REQUIRE_AC Flag to fu-plugin-test.c
This commit is a solution to the issue filed at
https://github.com/fwupd/fwupd/issues/3501. It sets a the AC power flag for the
fake webcam device.
2021-07-22 17:12:01 +01:00
Mario Limonciello
7787ba6df9 Add a .clang-format file and helper tool
It won't automatically be enforced, but should be picked up by editors
that support it (such as VS code + CPP extension)

It doesn't yet follow project style entirely, so more tweaking is
likely needed.

Also add a helper tool for reformatting new files to match project style
2021-07-22 16:38:29 +01:00
Richard Hughes
f2fd6b0717 trivial: Do not save the self test quirk silo to disk
This also speeds up the tests as the amount of pointless i/o is reduced.

Fixes https://github.com/fwupd/fwupd/issues/3522
2021-07-22 12:51:47 +01:00
Richard Hughes
6b238b2daa redfish: Automatically connect the BMC network interface at startup
Some distributions like RHEL change the default to not autoconnect
ethernet devices. This breaks connecting to the SMBIOS-defined BMC
adapter which means all the reads fail after a 60s timemout.

Autoconnect the internal USB ethernet adapter so we can use Redfish
without user action.
2021-07-22 12:48:22 +01:00
Richard Hughes
6b151a6acb redfish: Fix parsing USB/PCI network VID/PIDs 2021-07-22 12:48:22 +01:00
Richard Hughes
70a64190cb redfish: Limit requests to 30s max
The default in new libcurl versions is 'forever' which isn't useful for
a shared daemon.
2021-07-22 12:48:22 +01:00
Richard Hughes
ecd4c5431b redfish: Fix the docs to match reality 2021-07-22 12:48:22 +01:00
Richard Hughes
9f808bdbc0 uefi-capsule: Convert two metadata booleans to private flags 2021-07-22 12:47:54 +01:00
Richard Hughes
305e69f73b uefi-capsule: Rename the plugin flag to match the device flag 2021-07-22 12:47:54 +01:00
Richard Hughes
7b40c111c7 uefi-capsule: Move the results capsule to the FuDevice subclass
This allows us to create subclasses of FuUefiDevice that use different
ways to report update success.
2021-07-22 12:47:54 +01:00
Richard Hughes
55f6fd435a Add a ->get_results() vfunc that can be used by subclasses of FuDevice 2021-07-22 12:47:54 +01:00
Richard Hughes
d562c007a3 update-capsule: Move FuUefiDevice to a derivable for future use 2021-07-22 12:47:54 +01:00
Daniel Campello
924aa5a44b upower: Move battery_threshold setting to fu-engine
Change-Id: I63b4735bbaaf6f2cbdfb3f73b70b1fd4b3087a70
2021-07-21 21:53:57 +01:00
Richard Hughes
0920c44088 powerd: Use the system-defined battery threshold 2021-07-21 09:36:11 -06:00
Richard Hughes
56bf223a0f powerd: trivial style fixups 2021-07-21 09:36:11 -06:00
George Popoola
357bfd07da powerd: DBus Connection and Parsing
A series of changes are made to the powerd skeleton
plugin in order to reach two goals: ensuring that it handles cases correctly, given certain
information about the battery and/or certain return types and that it
successfully retrieves battery information from powerd to be used later.

Logic is then added to ensure updates are only performed
when that battery level is at or above the minimum threshold.
Then logic is added that checks if the device being updating requires
AC power. Along with this, specific
error statements are added for each scenario where an update is blocked.

To address the next goal, within fu_plugin_startup(), a GDBus connection
is established. However, instead of a direct connection to
powerd, the connection is changed to link to the general system bus with
g_bus_get_sync(). From there, a proxy is created to represent the
connection to powerd. A test call is made for the name of the service that the
proxy represents to check for successful communication.

Then, in fu_plugin_update_prepare(), the existing proxy is called and in the call,
the "GetBatteryState" is passed to make a method call method. The
response is filled into a GVariant, whose entries are initialized in new variables to use
for battery checks. And checks are added to make sure every step was
successful.
2021-07-19 13:40:11 -07:00
Twain Byrnes
379250996a Skeleton plugin for powerd
This CL creates a mostly empty fu-plugin-powerd.c that
has the file disable itself on startup with an error.

The README.md file was re-created to include information on
powerd and the specific interface it will use.

A meson.build file re-created to call fu-plugin-powerd.c.
It excludes a .conf install function was removed to be consistent with
an upstream change.

The general meson.build file includes the
powerd subdirectory for powerd to compile.

No .quirk file was included. There will be general daemon.quirk file for all plugins.

FIXUP: Adjusted copyright format and whitespace in fu-plugin-powerd.c
and plugin returns false on startup. Also added to "fu-plugin-powerd.so"
entry fwupd.spec.in.
2021-07-19 13:40:11 -07:00
Richard Hughes
88fbc42188 Allow returning the approved and blocked checksums in JSON format 2021-07-18 22:35:31 +01:00
Richard Hughes
f1ac4291f2 Allow returning the archive details in JSON format 2021-07-18 22:35:31 +01:00
Mario Limonciello
798d1ed3ee trivial: update markdown for pre-commit style 2021-07-18 14:42:47 -05:00
Mario Limonciello
68186a9a1c trivial: Add markdown lint to pre commit CI 2021-07-18 14:42:47 -05:00
Piotr Drąg
9a109703f2 Update POTFILES.in 2021-07-18 16:46:42 +01:00
Richard Hughes
15b668c0c6 Open the device proxy in the engine where required
The benefit of using the proxy device is that we can 'use' the proxy
device for device access, but 'report' the progress on the passed
FuDevice instance.

This means the front-end reports the device status correctly when
updating composite devices that us proxies.

The comment always said we should move it to the daemon if another
plugin started doing this, and that is now.
2021-07-17 17:20:01 +01:00
Richard Hughes
a0fd32f418 vli: Fix a regression when installing VL820Q7 firmware
This regressed in c255034574 which caused
ThinkPad Thunderbolt 3 Workstation Dock updates to fail.

Fixes https://github.com/fwupd/fwupd/issues/3460
2021-07-17 15:09:11 +01:00
Richard Hughes
3dfae9dc1b Save the update state to the database correctly all of the time
Setting the state on the 'wrong' bootloader device means we don't get
asked to submit a report when the runtime device comes back.

Also connect to the fields we care about being accurate in the history
database, rather than trying to second-guess when is a good time to
sync the object with the database.
2021-07-16 21:11:53 +01:00
Richard Hughes
f1f0180433 trivial: Add notify::update-error support 2021-07-16 21:11:53 +01:00
Richard Hughes
95d6963d29 Allow returning the historical result in JSON format 2021-07-15 20:34:07 +01:00
Richard Hughes
82ebc64f23 Allow returning the plugin list in JSON format 2021-07-15 20:34:07 +01:00
Richard Hughes
a122098eb8 Allow returning the remote list in JSON format 2021-07-15 20:34:07 +01:00
Richard Hughes
9829103be9 trivial: Add some generic helpers for building JSON 2021-07-15 20:34:07 +01:00
Richard Hughes
f0bc835769 Move all the fwupdagent code to fwupdmgr
We want to provide a lot more in JSON format in the future, and this
will reduce a lot of code duplication.

As various people are using this in the wild, the existing fwupdagent
binary just shims requests to fwupdmgr as required. We'll stop doing
this for 2.0.0 or something.
2021-07-15 20:34:07 +01:00
Richard Hughes
942802063e trivial: Remove the unused parent instance from the private struct
I assume at some point we forgot to remove it when converting an object
from FINAL to DERIVABLE and the anti-pattern just got copied around the
codebase...
2021-07-15 16:20:19 +01:00