Commit Graph

2389 Commits

Author SHA1 Message Date
Twain Byrnes
eed815331c Inhibit system suspend during update
Create and destroy /run/lock/power_override/fwupd.lock.
This file will hold the contents of getpid (), which will
stop the device from being suspended while the file exists.
The file will be created and written just before the
update is put into motion and be destroyed once the update
finishes, or upon restart in case of catastrophic failure.

Change-Id: If8dd17b0358862a842c9589e11ed0de12d852797
2021-08-04 08:33:57 +01:00
8BitDo
c381b334eb 8bitdo: Fix N30 Pro 2 install duration 2021-08-03 18:35:07 +01:00
Richard Hughes
27fbab1990 redfish: Disable the uefi_capsule plugin if coldplug succeeded
We don't want to show the big warning about the missing ESRT on server
hardware that is managed by a BMC:

    WARNING: UEFI capsule updates not available or enabled in firmware setup
      See https://github.com/fwupd/fwupd/wiki/PluginFlag:capsules-unsupported for more information.
2021-08-03 13:10:10 +01:00
Richard Hughes
6c2535a71f uefi-capsule: Disable all UX capsules for Lenovo hardware
Applying updates to my new P1G3:

 * schedule the update in fwupd
 * boot into the BootNext
 * apply the capsule with RT->UpdateCapsule
 * reboot with RT->ResetSystem

Except the firmware updater EFI binary then wasn't running. The ESRT
last_attempt_status comes back as Success on the reboot.

Disabling the UX capsule made the update apply correctly each and every
time. Until we can work out what models are affected, use a per-vendor
quirk to avoid delaying the release.
2021-08-02 14:26:45 +01:00
Richard Hughes
f12068d2e9 Allow devices to only accept version upgrades
See https://github.com/fwupd/fwupd/issues/3554 for details.
2021-07-31 20:41:21 +01:00
Mario Limonciello
143efb9d88 trivial: only build powerd on new enough glib
snap has an older glib and the plugin fails to compile.
2021-07-30 20:25:46 -05:00
George Popoola
1a58398afb powerd: Creating recurring powerd callback
This CL moves the battery information retrieval into a new function,
called "fu_plugin_powerd_callback()", which returns the information in a
struct.

This information is then used in fu_plugin_update_prepare() for battery
checks. There is also a g_timeout_add() function being created in
fu_plugin_startup() in order to enable the plugin to repeatedly send a method
call to powerd.

fu_plugin_update_prepare is removed as its functionality is now handled
by src/fu-engine.c
2021-07-30 10:58:40 -06:00
Daniel Campello
40295c673d trival: reformat fu-plugin-powerd.c 2021-07-30 10:58:40 -06:00
Richard Hughes
32997b10f7 realtek-mst: Add a warning that extreme caution should be used 2021-07-30 09:26:43 +01:00
Jerry Zhang
bb5bae8c17 dfu: Add support for more Poly usb devices
Specify the Flags in dfu.qurik for Poly Studio R30, P5 and E70.
2021-07-28 18:46:53 +01:00
Mario Limonciello
b87c6dab95 uefi-capsule: Add support for installing UEFI updates from GRUB
Shim has had a hard time with loading updates from arguments in the
most recent release and this isn't the first time that happened.

Give distros and users an escape hatch that will allow using GRUB
instead.
2021-07-28 17:11:39 +01:00
Richard Hughes
3747e245e5 uefi-capsule: Add support for CapsuleOnDisk
Based on a patch by Ilias Apalodimas <ilias.apalodimas@linaro.org>,
many thanks.

Fixes https://github.com/fwupd/fwupd/issues/2900
2021-07-28 17:11:39 +01:00
Richard Hughes
a1f8096c53 lenovo-thinklmi: Remove the faulty test for the update_error
We should be just checking if the thinklmi plugin inhibited the device,
and if we fix the bug where the last_attempt_status value was not being
read on startup then this test will then fail.
2021-07-28 17:11:39 +01:00
Daniel Campello
2ece14d9e3 Fix battery threshold handling when AC is *not* required 2021-07-27 17:23:15 -06:00
George Popoola
8e4624809c powerd: Enable updates on devices without battery
This adds a condition to the powerd plugin that passes updates on devices
that do not give provide valid battery information or whose battery
information is unknown, such as Chromeboxes, which have no battery to
read.
2021-07-27 15:36:51 -06:00
Richard Hughes
dfdecb304c amt: trivial: Fix another critical warning about missing context 2021-07-23 13:57:11 +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
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
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
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
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
Mario Limonciello
798d1ed3ee trivial: update markdown for pre-commit style 2021-07-18 14:42:47 -05: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
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
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
a71f100e5a redfish: Use the HotPluggable attribute if provided
Although, this only seems provided for PSU devices...
2021-07-14 15:21:04 +01:00
Richard Hughes
a564e458d2 trivial: Fix Python linting issue spotted by Codacy 2021-07-14 15:20:57 +01:00
Richard Hughes
095354e1d8 ebitdo: Add the alternate vendor name into the allowlist 2021-07-14 08:34:30 +01:00
Daniil Lunev
0af67e3e50 emmc: Filter out rpmb and boot block devices
The move to query sysattr for the name inadvertly changed the extent of
devices accepted by emmc probe. udev rules setup ID_NAME only for main
block device, but not for rpmb or boot, while 'name' sysattr is present
for all of them for they point to the same parent. The original check
for name was brittle either way and relied on a side effect of udev
subsystem. This CL introdues a proper filtering check that picks up only
the main devices. That is important because an attempt to perfrom an
update not on the main device returns a cryptic timeout error.

Change-Id: I3c2f5597c3e3ca2124c87cade3f345dece94027e
2021-07-14 07:38:45 +01:00
Peter Marheine
000ee9696c flashrom: remove PS175 support
This is now implemented by the parade_lspcon plugin.
2021-07-14 06:40:38 +01:00
Peter Marheine
a12d715038 New plugin: parade-lspcon 2021-07-14 06:40:38 +01:00