Allow fwupd to use the BatteryStatePoll signal instead
of the GetBatteryState method call so that fwupd does
not need to run a timer itself and is automatically updated
on power connect/disconnect.
Change-Id: I81aad6a5933fa267473a83d1b97f4638235b155a
All the other vfuncs have 'plugin, device, flags' but prepare and
cleanup vfuncs being 'plugin, flags, device' order has been triggering
my OCD for the last few years.
We've just broken the symbol names, so it's the right time to fix this.
More than one person has asked about 'why call fu_plugin_update() for a
reinstall or downgrade' and I didn't have a very good answer.
The plugin API is not officially stable, and we should fix things to be
less confusing. Use the same verbs as the FuDevice vfuncs instead.
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
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
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.
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.
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.