Commit graph

72 commits

Author SHA1 Message Date
Richard Hughes
b0bbb29df1 Add a config option 'EnableWattsUpPro' to disable the Watts Up Pro device
Annoyingly, the device used in the Watts Up Pro device seems to be a generic
USB->serial adaptor, which means it doesn't have a unique vendor and product
ID. If we try to probe for the WUP device, we can actually upset other devices
that are not expecing to be probed. This fixes #33846 although we actually
still need to be more strict in detecting a true WUP device.
2011-03-14 11:01:12 +00:00
Michael Biebl
d1e5f6a4da Depend on stable GUdev API
The GUdev API was declared stable in udev release 147.
Bump the version in the configure check and drop the
G_UDEV_API_IS_SUBJECT_TO_CHANGE defines.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-09 11:03:44 +00:00
Arnaud Patard
8b9ee53133 up-input.c: fix bitmap check
In up_input_coldplug(), some checks are done on the input device found in order
to detect if it's a lid switch or not.

The following one is problematic :

         /* convert to a bitmask */
         num_bits = up_input_str_to_bitmask (contents, bitmask, sizeof (bitmask));
         if (num_bits != 1) {
                 g_debug ("not one bitmask entry for %s", native_path);
                 ret = FALSE;
                 goto out;
         }

Checking if there's only 1 bit set is wrong. It's nice if you have a x86 with
acpi using 1 input device for the lid switch but it's not always nice.
One can create input devices with gpios-keys like this:

 static struct gpio_keys_button keys[] = {
         {
                 .code = SW_LID,
                 .gpio = ...,
                 .type = EV_SW,
                 .desc = "Lid Switch",
         },
         {
                 .code = SW_RFKILL_ALL,
                 .gpio = ...,
                 .type = EV_SW,
                 .desc = "rfkill",
         },
 };

The resulting SW bitmap will be 9 and thus there are 2 bits sets and due to the
mentionned check, the device is ignored by upower.

As a fix, I'm checking if the number of bits is between 0 and SW_CNT
bits.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-04 17:29:44 +00:00
Richard Hughes
38199e44ff Add an option for polling dock devices in UPower.conf, defaulting to false 2011-03-03 14:02:27 +00:00
Richard Hughes
17b7aef701 linux: use the number of active DRM devices to determine the system docked status
Not ideal, but better than relying on ACPI.
2011-01-04 18:05:09 +00:00
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