This makes dbus defer starting upowerd to systemd instead of doing it itself
and thus puts the daemon under proper systemd supervision.
Signed-off-by: Richard Hughes <richard@hughsie.com>
Defaulting to true, it controls whether we want the powersave commands
to be run when running on battery/plugging ac.
Signed-off-by: Richard Hughes <richard@hughsie.com>
in case some sensors are in AMPHOUR/AMPS and others in WATTHOUR/WATTS,
don't assume they are all the same type. As a benefit, shrinks the
code a bit.
Signed-off-by: Richard Hughes <richard@hughsie.com>
since acpibat.c r1.59, bst_rate type is SENSOR_AMPS or SENSOR_WATTS
and value has been corrected. Tweak accordingly.
Signed-off-by: Richard Hughes <richard@hughsie.com>
This reverts commit 14761c09d2.
The real reason for the failure is that Makefile.am calls the script with
"python" which is Python 2, but we need Python 3.
unittest.TestCase unfortunately does not have any public API to check whether
a test case succeeded, so we use the private self._outcomeForDoCleanups. This
does not seem to exist every time, so avoid a crash if it doesn't.
According to Anton Vorontsov (Linux power supply maintainer) power
supplies should not export a present property when they are not
hotpluggable and users of the properties should handle supplies
without present-property as always present.
This patch implements this feature using an additional
sysfs_file_exists call before sysfs_get_bool.
Signed-off-by: Richard Hughes <richard@hughsie.com>
Spotted when running regression tests in KVM. There, initializing a HID device
causes a "could not initialize libusb: -99" warning, but the device is created
nevertheless. Do not crash in _finalize() by trying to call libusb_exit(NULL).
For hardware that has no rate data we use the differences in charge over a time
period to work out the effective rate. Using linear regression this estimation
is much more realistic.
To do this, introduce a simple circular buffer and use an index to calculate
the rate on each update.
Signed-off-by: Richard Hughes <richard@hughsie.com>
Under Linux, regardless of the exit code of /usr/bin/pm-is-supported, it will
always set CanSuspend and CanHibernate to true due to a logic error in
up_backend_supports_sleep_state in src/linux/up-backend.c: The 'ret' variable
is re-used for the return code without being re-initialized to false after the
call to g_spawn_command_line_sync.
Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
Files might not be there, or in the case of cross-compilation, they most
definitely won't be there (and if they are, they are not the ones you
should be looking for). Instead use the autoconf-defined $host variable to
identify for what system we're building for.
Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
Signed-off-by: Richard Hughes <richard@hughsie.com>