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".
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’
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.
Native Linux suspend-to-disk does not use compression, and needs 2 KB of page
meta information for each MB of active memory. So bump the previous waterline
of 80% of active memory to 100.2%. Add an extra .05% to prevent rounding errors.
This should make the prediction whether hibernate is going to work very
accurate. However, it might prevent hibernate for folks who use an alternative
userspace solution like uswsusp which do support compression.
http://lists.freedesktop.org/archives/devkit-devel/2010-July/000867.html
In linux backend, g_object_set was called with wrong
argument types for time-to-empty,time-to-full and percentage
properties. This patch uses explicit casts in the same way as freebsd
backend.
Signed-off-by: Mariusz Ceier <mceier@gmail.com>
pm-is-supported does all the work upower was duplicating, and it handles more
use cases than the old upower code did. No point in duplicating functionality.
Signed-off-by: Richard Hughes <richard@hughsie.com>
up_daemon_check_swap_space uses the Active: line from /proc/meminfo to
determine the amount of swap the system needs to be able to suspend. However,
because Active: includes both anonymous and file-backed pages, this greatly
overestimates the amount of swap needed. File-backed pages can be written back
to disk and so do not consume swap.
Instead, up_daemon_check_swap_space should use Active(anon): from /proc/meminfo
because only anonymous pages need to be written out to swap during a suspend.
Signed-off-by: Richard Hughes <richard@hughsie.com>