Commit Graph

7 Commits

Author SHA1 Message Date
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
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