Previously we set the "max age" to seconds and then waited for exactly 2
seconds until we wrote the history data back to files. In a lot of cases this
actually took a tad more than 2 seconds, which caused the second-last history
entry to disappear as well.
Reduce the waiting to 1.1 seconds, which will now give us 900 ms to write back
the history file. Still not ideal, but the best we can do in the test suite.
In our test suite, create and use a temporary directory for our history. This
makes the history check work as non-root.
Consequently, drop the skipping of the history check for "make distcheck".
src/linux/up-device-idevice.c explicitly uses libplist, so check for it in
configure.ac. With gcc 4.5 private requirements of libraries aren't
transitively linked any more, thus the build fails with
CCLD upowerd
/usr/bin/ld.bfd.real: linux/.libs/libupshared.a(libupshared_la-up-device-idevice.o): undefined reference to symbol 'plist_dict_get_item'
/usr/bin/ld.bfd.real: note: 'plist_dict_get_item' is defined in DSO /usr/lib64/libplist.so.1 so try adding it to the linker command line
/usr/lib64/libplist.so.1: could not read symbols: Invalid operation
Include <stdint.h> so that <linux/fs.h> can use uint64_t. Arguably a bug in the
kernel headers, but it costs us nothing to safeguard against it.
CC libupshared_la-up-device-idevice.lo
In file included from sysfs-utils.c:39:0:
/usr/include/linux/fs.h:37:2: error: expected specifier-qualifier-list before ‘uint64_t’
Using AM_MAINTAINER_MODE allows to modify the build systemd without
triggering the autotools. We enable it by default so the current
behaviour does not change.
Signed-off-by: Richard Hughes <richard@hughsie.com>
When a full battery starts to discharge, but reports its status as 'Unknown',
it takes a few minutes before g-p-m notices any change.
upowerd guesses the battery is fully charged as long as it has over 90% charge.
I see no reason to delay the reporting of discharging of the battery.
Let's remove this heuristic.
Signed-off-by: Richard Hughes <richard@hughsie.com>
Add a new DBus interface based on the QoS one to provide for controlling a
keyboard backlight via the Linux leds interface.
Signed-off-by: Richard Hughes <richard@hughsie.com>
Parsing huge log files at startup will demolish startup time. Cull old
entries when the file is resaved to keep them sane. Also add the needed
self tests to check this in the future.
All callers of up_polkit_get_subject() just exit without returning an error to
the D-BUS caller if they fail to get the PolicyKit subject. Do that in
up_polkit_get_subject() itself now, for convenience.
Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
Do not send a D-BUS return message any more in up_polkit_is_allowed(), since
this makes it hard for callers to ensure that they return exactly one result to
the D-BUS caller. Instead, just pass a GError to the caller.
Update up_daemon_suspend_allowed() and up_daemon_hibernate_allowed()
accordingly, to always return either a result or an error.
Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
dbus_g_method_return_error() does not free or take ownership of the passed
GError, we need to free it ourselves.
Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
Checking for enough hibernation swap space at the daemon startup is not
sufficient, since both active memory as well as swap space change over time.
Now check whenever we receive a hibernate request or read the can-hibernate
property.
Commmit fc7c6e003 had a thinko, UP_DAEMON_WATERLINE specifies (active
memory)/(available swap), not the other way around. So replace it with 99%
instead.
Also update the documentation of up_backend_get_used_swap() to explain what the
returned percentage actually means.