Commit graph

67 commits

Author SHA1 Message Date
Richard Hughes
2af7a6e091 Support the power_now sysfs attribute to get time remaining on new kernels
The kernel has removed the insanity of providing current_now in either
(and unspecified) units of uVh or uWh and instead provides power_now
for the power rate value.

Related commits:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=b137b9942a07843c64a934cfdb7d43155e507e13
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=7faa144a518c456e2057918f030f50100144ccc6

Thanks to Florian Eitel for the initial patch.
2011-01-04 09:30:22 +00:00
Martin Pitt
04dd349103 Fix compilation eror against Linux 2.6.36
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’
2010-11-04 18:45:10 -04:00
Richard Hughes
59893663fb Port from EggDebug to the GLib built-in logging framework 2010-11-01 11:28:31 +00:00
Michal Schmidt
e76b05967b remove the UP_DEVICE_SUPPLY_CHARGED_THRESHOLD heuristic
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>
2010-10-21 16:18:44 +01:00
Richard Hughes
163d5fc355 Do not continue to poll the serial port if there is no Watts Up Pro adaptor 2010-09-20 16:22:45 +01:00
Richard Hughes
7e45ad91ed trivial: fix make distcheck 2010-09-17 16:10:39 +01:00
Martin Pitt
c4a1c15d0c Fix UP_DAEMON_WATERLINE harder
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.
2010-07-07 15:08:43 +02:00
Martin Pitt
04eefe984c src/linux/up-backend.c: Add missing #include
We need sys/wait.h to get the WEXITSTATUS (and related) macros.
2010-07-07 11:20:47 +02:00
Richard Hughes
6118ac82ec Get the powersave command from the backend rather than hardcoding Linux specifics 2010-07-07 10:07:37 +01:00
Mariusz Ceier
ac8fa9d5be up-device-supply.c: Fix #27902 Bug - Daemon Segmentation Fault
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>
2010-07-02 14:04:42 +01:00
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
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
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
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
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
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
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
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
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
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
8362088d12 trivial: rename some internal defines for the upower move 2010-01-18 14:04:24 +00:00
Richard Hughes
bc928f7ae8 trivial: switch to using the new udev attribute names (no ABI or API break) 2010-01-18 13:20:36 +00:00
Richard Hughes
c8cec18f06 trivial: DkpInput -> UpInput (no ABI or API break) 2010-01-18 13:15:47 +00:00
Richard Hughes
e04b5a9e00 trivial: DkpNative -> UpNative (no ABI or API break) 2010-01-18 13:12:37 +00:00
Richard Hughes
ad282a532c trivial: switch to using the new internal library name (no ABI or API break) 2010-01-18 13:10:00 +00:00
Richard Hughes
13f7addd62 trivial: switch to using the new marshal names internally (no ABI or API break) 2010-01-18 13:08:31 +00:00
Richard Hughes
8d4ec58206 trivial: switch to using the new enum names internally (no ABI or API break) 2010-01-18 12:57:50 +00:00
Richard Hughes
25e51c9613 trivial: DkpDevice -> UpDevice (no ABI or API break) 2010-01-18 12:49:30 +00:00
Richard Hughes
d2550b4c78 trivial: DkpDaemon -> UpDaemon (no ABI or API break) 2010-01-18 12:35:47 +00:00
Richard Hughes
2562bc6aa6 trivial: DkpBackend -> UpBackend (no ABI or API break) 2010-01-18 12:32:06 +00:00
Richard Hughes
15ac5102c8 trivial: Rename a lot of the source files from dkp-foo to up-foo, no API or ABI changes 2010-01-18 12:26:55 +00:00
Richard Hughes
e93895a257 Use a fallback for the capability bit when checking the lid status. Fixes #25041 2010-01-11 15:56:53 +00:00
Richard Hughes
99e9925654 Make some small cleanups in prep for the release 2009-12-01 08:55:04 +00:00
Byron Clark
1dbe1c87c5 Use a gdouble for percentage.
The percentage field of the device object is a gdouble.  Low battery
calculations should read this field as a gdouble instead of a guint to
get the correct value.   This fixes the case where clients see
on-low-battery possibly changing with every percentage of battery
discharge.

Signed-off-by: Byron Clark <byron@theclarkfamily.name>
2009-11-25 21:13:15 +00:00
Richard Hughes
7482af780b Some batteries give out massive rate values when nearly empty 2009-11-23 14:04:45 +00:00