Commit graph

364 commits

Author SHA1 Message Date
Victor Lowther
6770e8cb34 Use pm-is-supported to test if various sleep modes are supported.
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>
2010-06-14 08:59:40 +01:00
Victor Lowther
da3a51d2e8 Cast cnt to int to stop gcc from complaining.
GCC was complaining about int and ssize_t being differnt types.
Make it quit doing that.
2010-06-14 08:56:27 +01:00
Richard Hughes
6ba86292e9 Port to GTest 2010-06-05 17:00:34 +01:00
Richard Hughes
82a6a882d0 Assign names to our idle sources when using new versions of glib2
This makes it possible to profile more accurately using systemtap
2010-06-05 15:55:29 +01:00
Richard Hughes
34add0cfe2 Add UP_DEVICE_KIND_COMPUTER as we'll need UP_DEVICE_KIND_TABLET for wacom tablets 2010-06-01 14:25:10 +01:00
Steven Walter
6bb6602c06 When calculating used swap space, only use anonymous pages
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>
2010-05-29 13:12:57 +01:00
Richard Hughes
37504601f3 trivial: print the specific error from libusb1 2010-05-28 15:15:11 +01:00
Richard Hughes
758ad538ce trivial: Get rid of some over-verbose debugging 2010-05-28 15:13:28 +01:00
Richard Hughes
181f673908 trivial: Rename a few 'DeviceKit-power' strings we missed 2010-05-28 15:00:07 +01:00
Bastien Nocera
18c8d26b02 Fix compilation of the idevice device
My fault :(
2010-05-28 14:39:16 +01:00
Bastien Nocera
5cec5b180f Fix up a few leaks Richard introduced...
Signed-off-by: Richard Hughes <richard@hughsie.com>
2010-05-28 14:11:04 +01:00
Richard Hughes
36bf9c5cde trivial: fix a tiny warning reported by clang with the capacity code intial value 2010-05-28 14:10:22 +01:00
Richard Hughes
5c17b5a147 Fix up a potential crasher in the CSR device code 2010-05-28 14:03:56 +01:00
Bastien Nocera
7019d214f8 Add battery query support for iDevices
https://bugs.freedesktop.org/show_bug.cgi?id=28286
Signed-off-by: Richard Hughes <richard@hughsie.com>
2010-05-28 13:49:56 +01:00
Richard Hughes
2b826a3169 Port UPower to libusb1 to avoid crappy unfixable crashes 2010-05-18 09:37:17 +01:00
Kyle McMartin
5881e7435f Detect when the kernel changes the reported charge units. Fixes rh#587112
Signed-off-by: Richard Hughes <richard@hughsie.com>
2010-05-11 15:53:48 +01:00
Richard Hughes
5e644fd2e0 trivial: correct some debugging statements that made things more confusing 2010-05-10 22:47:50 +01:00
Richard Hughes
3952c6d98a Ensure we sent ::notify signals when UpDaemon properties change 2010-05-10 22:40:17 +01:00
Richard Hughes
ab1bc59e56 Ensure we send ::Sleeping() if clients do not call AboutToSleep() 2010-05-07 20:52:00 +01:00
Richard Hughes
43fd837e00 Only emit ::Sleeping() after we've checked AboutToSleep() 2010-05-07 20:38:46 +01:00
Sascha Silbe
4baf27ae15 fix recognition of lithium iron phosphate (LiFePO4) batteries
The linux kernel returns "LiFe" for lithium iron phosphate batteries,
not LiFo.
2010-05-03 15:18:44 +01:00
Richard Hughes
3dee7b22f8 Provide UpDaemon with C setters rather than relying on GObject properties 2010-04-19 17:05:59 +01:00
Richard Hughes
5f1e64709b Add a config file with SleepTimeout and AllowHibernateEncryptedSwap entries 2010-04-14 10:08:57 +01:00
Michael Biebl
3d62778377 trivial: Add stubs to dummy backend to make it compile again. 2010-03-30 08:39:17 +01:00
Richard Hughes
d1bd4d42fd Get the suspend and hibernate commands from the backend, rather than hardcoding Linux specifics 2010-03-29 16:42:35 +01:00
Richard Hughes
4b5dc883e6 Get the swap size from the backend, rather than hardcoding Linux specifics 2010-03-29 14:21:51 +01:00
Richard Hughes
0198498350 Get the encrypted swap status from the backend, rather than hardcoding Linux specifics 2010-03-29 14:18:42 +01:00
Richard Hughes
4620a9d122 Get the kernel sleep capabilities from the backend, rather than hardcoding Linux specifics 2010-03-29 14:16:11 +01:00
Richard Hughes
6d607a406c Convert the daemon to using objects from libupower-glib, not devkit-power-gobject 2010-03-26 12:49:01 +00:00
Richard Hughes
daa2d5f3b7 Do not warn what we are correcting energy-full when there is no data to copy 2010-03-26 11:29:38 +00:00
Michael Biebl
37a56ea0da Make dummy backend usable for architectures without a native backend
Currently, the dummy backend is mostly used to run the unit tests.
We want to make it usable though on architectures, like GNU/Hurd, which
dont't have a native backend yet.

Compile two different flavours of the dummy backend: one with the TEST
code enabled and which is used by up_self_test, and one without the TEST
code, used by upowerd when the dummy backend is selected.

Patch is based on work by Pino Toscano.

Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2010-03-26 11:17:49 +01:00
Michael Biebl
9f26b3f866 Remove libdevkit-power-gobject dependency from backends
The backends [linux/freebsd/dummy] no longer require
libdevkit-power-gobject, so
- remove -I$(top_srcdir)/devkit-power-gobject from the include path
- don't link the backends against libdevkit-power-gobject but upowerd
  (which unfortunately still needs it).

Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2010-03-26 11:15:26 +01:00
Michael Biebl
197f994945 Fix up the FreeBSD backend compile
Signed-off-by: Richard Hughes <richard@hughsie.com>
2010-02-23 21:31:41 +00:00
Richard Hughes
fd94c5d485 trivial: remove two unused variables which break the build when using strict warnings 2010-02-09 10:44:37 +00:00
Martin Pitt
b93915a377 Add {Suspend,Hibernate}Allowed D-Bus methods
Add two D-Bus server methods to check whether the caller has the privilege to
suspend or hibernate.

This enables us to check for PK privileges in UpClient's
can_{suspend,hibernate} properties, so that clients like gnome-session or
gnome-power-manager hide the suspend/hibernate related actions if the admin or
OEM disabled suspend/hibernate through a PolicyKit .pkla file.

https://bugs.freedesktop.org/show_bug.cgi?id=26473
2010-02-09 10:42:36 +00:00
Martin Pitt
a057e36751 Add up_polkit_is_allowed() function
Add a new polkit helper function up_polkit_is_allowed() which checks whether
the caller has or can get a particular privilege, but without interactive
authentication.

https://bugs.freedesktop.org/show_bug.cgi?id=26473
2010-02-09 10:42:34 +00:00
Richard Hughes
02914e71ec Add a new method and two new signals to inform userspace of the pending suspend and the resume event
Based on an idea from Matthew Garrett and Lennart Poettering
2010-02-08 12:18:50 +00:00
Richard Hughes
4214c6a345 trivial: do not free errors that we do not allocate in the error paths 2010-02-07 21:37:00 +00:00
Richard Hughes
b9d7b8aea9 trivial: Fix up a void marshalling type 2010-02-07 21:35:18 +00:00
Michael Biebl
8e3791afe4 devkit-power-gobject/up-enum.h be gone
Port from devkit-power-gobject/up-enum.h to libupower-glib/up-types.h
2010-02-06 13:46:03 +00:00
Michael Biebl
4a12ee1bf7 Make sure the tests link against all necessary libraries. 2010-02-06 13:43:02 +00:00
Michael Biebl
0ff7b4fdff Move the history files to /var/lib/upower
Distros should move existing files from
/var/lib/DeviceKit-power to /var/lib/upower on upgrades in their
maintainer scripts.
2010-02-05 08:35:20 +00:00
Michael Biebl
9852851db1 Use the new project name in g_option_context_new 2010-02-05 08:35:14 +00:00
Michael Biebl
83c0574466 Remove EGG_* log define.
The EGG_* log defines don't seem to be used and still reference the old
DeviceKit-power name. So just remove it.
2010-02-05 08:35:11 +00:00
Richard Hughes
acfe9c3089 Update the Free Software Foundation address 2010-01-27 16:27:15 +00:00
Richard Hughes
21012c7d2e trivial: add some more gtk-doc markup to the new objects 2010-01-26 11:59:09 +00:00
Richard Hughes
5e8ba54573 trivial: rename the new libupower 'type' to 'kind' to avoid clashing with GObject generated names 2010-01-26 10:53:04 +00:00
Richard Hughes
faeb7ffabc Rename the man pages and rename the main daemon binary name 2010-01-21 14:47:21 +00:00
Richard Hughes
a3dd31ee57 Rename the PolicyKit rules from org.freedesktop.devicekit.power to org.freedesktop.upower 2010-01-18 17:05:25 +00:00
Richard Hughes
d27c836e97 Rename the DBus service from org.freedesktop.DeviceKit.Power to org.freedesktop.UPower 2010-01-18 16:53:12 +00:00