Commit Graph

5893 Commits

Author SHA1 Message Date
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
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
Ivan Mikhanchuk
db8a9927f4 modem-manager: add firehose update method
Adds firehose update protocol, qcdm port handling, program file copy to the cache directory
2021-07-13 21:57:08 +01:00
Ivan Mikhanchuk
5e04fae8f2 Add functions to read from and write to FU_PATH_KIND_FIRMWARE_SEARCH 2021-07-13 21:57:08 +01:00
Mario Limonciello
da895169a7 Add a new path for configuring runtime firmware load path
The kernel allows configuring this, and certain plugins will use this
path to be able to load firmware in the kernel driver through runtime,
but to flash to the device.
2021-07-13 21:57:08 +01:00
Richard Hughes
f7a23d7c88 Allow the client to watch for more property changes 2021-07-13 14:56:01 +01:00
Richard Hughes
a7409d3117 Fix the progressbar spinner to actually work
We need to use the private GMainContext we created.
2021-07-13 14:55:49 +01:00
Richard Hughes
9a4997e42b trivial: Always clear timeout when replacing in the devicelist 2021-07-13 09:31:53 +01:00
Richard Hughes
6578fb13e7 trivial: Add some sanity checks to the device list 2021-07-12 23:17:03 -05:00
Daniil Lunev
1ca9c92919 emmc: add check "name" sysattr is not NULL
At this point it has to be present, but better have the check for
correctness sake.
Follow up of
64fa633e30

Change-Id: I51b5995e25dc4dc4ec63b90af271cd90650d184d
2021-07-12 23:16:51 -05:00
Daniil Lunev
64fa633e30 emmc: use sysattr insted of udev attr lookup for device name
/run/udev/data/b* location of eMMC devices appears to be inaccessible
early on in the boot process which makes fwupd to skip eMMC devices if
the daemon started too early. ID_NAME udev attribute is effectively
copied from the sysfs attribute [1], thus making use of it is more
reliable.

[1] 1ed38f4174/etc/udev/rules.d/60-persistent-storage.rules (42)

Change-Id: I66b92dfeb13ec61b4d8166dd32a2460b6fbf92c2
2021-07-12 20:16:01 -05:00
Richard Hughes
73b9f8bd53 Allow multiple devices to set WAIT_FOR_REPLUG
This also means we no longer pass in just one device to the
fu_device_list_wait_for_replug() function, but we rather wait for *all*
of the active devices.

This also cleans up the confusion on whether the engine should wait for
the 'root' device or the child device as either (or both) can be set as
required.

This makes the replug far more predictable for devices that have
children even in bootloader mode.
2021-07-12 19:02:19 +01:00
Richard Hughes
89064bf410 trivial: Downgrade a warning to avoid a lot of extra code 2021-07-12 19:01:55 +01:00
Richard Hughes
8eecefeb3b trivial: Allow the cache to build in arch CI 2021-07-12 19:01:55 +01:00
Richard Hughes
b2ee236060 trivial: Show a critical warning if a device has no context 2021-07-12 19:01:55 +01:00
Richard Hughes
d938ab62e6 trivial: Add fu_device_add_guid_full() to control behaviour 2021-07-12 19:01:55 +01:00
Richard Hughes
53538685fc trivial: Add FU_DEVICE_INSTANCE_FLAG_NO_QUIRKS to avoid quirk matches 2021-07-12 19:01:55 +01:00
Richard Hughes
9c31d1fadd trivial: Set the FuContext on more devices 2021-07-12 19:01:55 +01:00
Richard Hughes
4934690a30 trivial: Add some useful debugging when auto-removing devices 2021-07-12 19:01:55 +01:00
Crag Wang
e35678e07b trivial: override support for fwupd build by runtime environment variable 2021-07-12 12:57:37 +01:00
Richard Hughes
e4aeb99296 trivial: Fix oss-fuzz by installing missing deps 2021-07-12 10:33:38 +01:00
Richard Hughes
488f2e1f37 Export the EFI and IFD parsers
We'll need to use this from another plugin soon.
2021-07-12 10:33:38 +01:00
Richard Hughes
0cc06f032c Add a flag to open and close with the parent device
This is a common pattern that is used in lots of plugins, so move the
logic into common code.
2021-07-11 16:37:47 +01:00
Richard Hughes
df297d3ee2 superio: Always ensure the version string is NUL terminated
Spotted by Coverity
2021-07-10 13:51:28 +01:00
Richard Hughes
f1dbd42934 superio: Fix a buffer overread when using --verbose
Spotted by Coverity
2021-07-10 13:51:28 +01:00
Richard Hughes
772f116104 superio: Hide more debugging output by default 2021-07-10 13:51:28 +01:00