Commit Graph

6 Commits

Author SHA1 Message Date
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
7b23f95a21 trivial: Fix up some introspection bugs 2021-04-28 16:19:50 +01:00
Richard Hughes
48f04721de Call g_type_ensure() when using fu_context_add_firmware_gtype()
This simplifies plugins as it means we don't need to remember to ensure the type just to be able to ->build() the firmware file.
2021-04-15 16:52:56 +01:00
Richard Hughes
45493b06d8 trivial: Fix a small memory leak in the new FuContext code
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33155
2021-04-11 19:01:33 +01:00
Richard Hughes
4d76d18d35 Set the system battery state and level on the FuContext shared state
This allows plugins to set the battery power state of the *machine* which means
we can automatically inhibit devices with FWUPD_DEVICE_FLAG_REQUIRE_AC set.

It also allows to set the BatteryThreshold to 25% for Lenovo hardware, and we
can override other vendors with further quirks as required.

Fixes https://github.com/fwupd/fwupd/issues/3084
2021-04-07 08:05:15 +01:00
Richard Hughes
b333e0045c Split out a shared system context
There is a lot of code in fwupd that just assigns a shared object type to
a FuPlugin, and then for each device on that plugin assigns that same shared
object to each FuDevice.

Rather than proxy several kinds of information stores over two different levels
of abstraction create a 'context' which contains the shared *system* state
between the daemon, the plugins and the daemon.

This will allow us to hold other per-machine state in the future, for instance
the system battery level or AC state.
2021-04-01 21:11:29 +01:00