Commit graph

1018 commits

Author SHA1 Message Date
Sascha Silbe
d7c6d0e8da Drop 'type' parameter from CancelRequest() signature
CancelRequest() never worked because the method signature in D-Bus
introspection data didn't match the actual function signature.

Since the 'type' parameter isn't needed by the implementation (cookies
are unique across all requests, not just requests of a certain type),
we drop it from the public API. This makes it easier for clients to
use the API as they only have to remember the cookie, not both cookie
and type. Since it never worked in the first place, there are no
backwards compatibility issues.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-05-30 16:19:27 +01:00
Sascha Silbe
79c11814cd Fix use-after-free of qos item
up_qos_init() registers a destroyer callback for the qos item array,
so the current item will be gone after the calls to
g_ptr_array_remove(). By storing the item kind in a local variable we
can pass it to up_qos_latency_perhaps_changed() later. Delaying the
removal from the array is not an option as
up_qos_latency_perhaps_changed() scans that array to re-evaluate the
target latency.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-05-30 16:19:25 +01:00
Richard Hughes
a75501f9d1 linux: Treat the battery state 'not charging' as PENDING_CHARGE
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=826215
2012-05-30 16:17:01 +01:00
Sascha Silbe
944118a879 Fix the LatencyChanged signal
The type of the 'value' parameter of the LatencyChanged signal is
integer, not boolean. Fixing this causes the signal to actually be
emitted.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-05-22 18:51:42 +01:00
Richard Hughes
616d6d6b96 trivial: post release version bump 2012-04-30 09:45:39 +01:00
Richard Hughes
3d99929440 Released UPower 0.9.16 2012-04-30 09:43:34 +01:00
Gary Ching-Pang Lin
c17a3f0d70 Correct the cap on the energy rate
Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-04-27 16:05:39 +01:00
Pavel Vasin
bf56cecab4 libupower-glib: fix small memory leak
Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-04-26 17:39:42 +01:00
Richard Hughes
28c8653ed8 Never detect HID devices with batteries as power supplies
Some HID devices with batteries (like bluetooth keyboards) have been creating
power supply devices in sysfs since Linux 3.3.
UPower thinks that they are system devices and shuts down the system if they
get low. This is bad.

This is fixed in Linux 3.4, where there is a new 'scope' file that defines if
the device is powering the system.
Helpfully ACPI batteries don't populate the scope value, but soon will.

Add support for the scope attribute now, and default to system devices if it's
missing. Note, you need to be running a 3.4 kernel or a 3.3 with the patch
backported for this to work.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=806295
2012-04-18 16:46:46 +01:00
Evan Broder
6fb36eb5eb Re-coldplug dock status when resuming from sleep
It's possible for the docked state of a laptop (i.e. the display
connectivity state) to change while the laptop is asleep.

Signed-off-by: Evan Broder <evan@ebroder.net>
Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-04-11 17:54:11 +01:00
Martin Pitt
1bb2b11b24 Fix crash in up_device_csr_finalize()
Commit 46f1c7f028 has a typo which prevents the fix from actually working.

https://launchpad.net/bugs/972300
2012-04-03 12:28:27 +02:00
Richard Hughes
2c02598806 Clamp the UPS percentage from 0 to 100 to fix syslog spam
This device bug seems to happen with CPS UPS units.
2012-02-17 10:30:47 +00:00
Richard Hughes
e51ffd27de Return all history records for a timespan of zero
This makes the code conform to the documentation.
2012-01-18 14:49:20 +00:00
Kelly Anderson
5b2211cb23 Do not print error message for missing /etc/crypttab.
Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-18 10:29:48 +00:00
Benedikt Morbach
07a6c353a2 Install a systemd service file if systemd is used
This makes dbus defer starting upowerd to systemd instead of doing it itself
and thus puts the daemon under proper systemd supervision.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-17 11:08:18 +00:00
Ryan Lortie
38d65955f4 libupower-glib: srcdir != builddir fix 2012-01-11 15:56:37 +01:00
Landry Breuil
19790b99a2 Add boolean RunPowersaveCommand to UPower.conf
Defaulting to true, it controls whether we want the powersave commands
to be run when running on battery/plugging ac.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06 16:40:09 +00:00
Landry Breuil
4f3150fb27 openbsd: set powersave command to apm -C/-A
Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06 13:40:50 +00:00
Landry Breuil
1f412fe279 openbsd: no need to pass the fd around
better access it where needed through the singleton.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06 13:40:50 +00:00
Landry Breuil
7cd8465811 openbsd: handle case where minutes_left might be negative
might not be useful since apm_fd is accessed through the singleton..

Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06 13:40:50 +00:00
Landry Breuil
3dfc0598f8 openbsd: improve logic wrt sensor type
in case some sensors are in AMPHOUR/AMPS and others in WATTHOUR/WATTS,
don't assume they are all the same type. As a benefit, shrinks the
code a bit.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06 13:40:50 +00:00
Landry Breuil
37ff0d4ddb openbsd: fix energy-rate calculation
since acpibat.c r1.59, bst_rate type is SENSOR_AMPS or SENSOR_WATTS
and value has been corrected. Tweak accordingly.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06 13:40:50 +00:00
Landry Breuil
60e474ead5 openbsd: use a singleton pattern to access /dev/apm
up_apm_get_fd() opens /dev/apm  only if it's not already opened.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06 13:40:50 +00:00
Landry Breuil
6c15694dbb openbsd: Fix history by not trying to refresh if /dev/apm wasn't opened yet
Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06 13:40:46 +00:00
Richard Hughes
3db50b0338 trivial: post release version bump 2011-12-05 09:50:44 +00:00
Richard Hughes
6600d371d3 Released UPower 0.9.15 2011-12-05 09:49:35 +00:00
Martin Pitt
6bb3623d46 src/linux/integration-test: Fail gracefully if GI is not available 2011-12-05 10:44:35 +01:00
Martin Pitt
8fc9a1d750 Fix invocation of src/linux/integration-test
In Makefile.am "check", do not call the test suite through "python". Just call
it directly and let the hashbang take care of the interpreter.
2011-12-05 10:32:04 +01:00
Martin Pitt
492a8c2283 Revert "src/linux/integration-test: Do not crash on absent _outcomeForDoCleanups"
This reverts commit 14761c09d2.

The real reason for the failure is that Makefile.am calls the script with
"python" which is Python 2, but we need Python 3.
2011-12-05 10:30:14 +01:00
Martin Pitt
14761c09d2 src/linux/integration-test: Do not crash on absent _outcomeForDoCleanups
unittest.TestCase unfortunately does not have any public API to check whether
a test case succeeded, so we use the private self._outcomeForDoCleanups. This
does not seem to exist every time, so avoid a crash if it doesn't.
2011-12-05 10:24:37 +01:00
Heiko Stübner
88c6d141ef upower: Handle Linux power supplies not exporting a present property
According to Anton Vorontsov (Linux power supply maintainer) power
supplies should not export a present property when they are not
hotpluggable and users of the properties should handle supplies
without present-property as always present.

This patch implements this feature using an additional
sysfs_file_exists call before sysfs_get_bool.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-12-03 13:10:08 +00:00
Richard Hughes
6b685799cc trivial: USB devices are assumed to be 5V 2011-11-29 15:59:36 +00:00
Richard Hughes
21da4824a7 trivial: fix the name of the percentage file 2011-11-29 15:47:26 +00:00
Richard Hughes
c7cf8aa16a Don't assert when the power_supply device type is usb 2011-11-29 15:42:24 +00:00
Richard Hughes
3901d902fd Move the wacom hack to allow us to support other types of USB device 2011-11-29 14:05:18 +00:00
Richard Hughes
d4ea1cb566 If a power-supply device doesn't report charge or energy, try to read the percentage 2011-11-29 14:04:22 +00:00
Martin Pitt
46f1c7f028 Fix crash in up_device_csr_finalize()
Spotted when running regression tests in KVM. There, initializing a HID device
causes a "could not initialize libusb: -99" warning, but the device is created
nevertheless. Do not crash in _finalize() by trying to call libusb_exit(NULL).
2011-11-11 15:50:15 +01:00
Martin Pitt
d92aec6520 src/linux/integration-test: Port to Python 3 2011-11-11 15:19:04 +01:00
Leonardo Robol
b971b43c45 Use linear regression to get better predicted battery times
For hardware that has no rate data we use the differences in charge over a time
period to work out the effective rate. Using linear regression this estimation
is much more realistic.

To do this, introduce a simple circular buffer and use an index to calculate
the rate on each update.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-10-19 17:13:51 +01:00
Richard Hughes
58f77e8aa6 Don't spam the log when we're saving history when on low power
Resolves: https://bugs.freedesktop.org/show_bug.cgi?id=41486
2011-10-06 09:12:04 +01:00
Landry Breuil
60e5e29188 Add --with-historydir to specify where we want the history files to be stored
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-10-04 14:53:46 +01:00
Richard Hughes
5b46a00a32 trivial: post release version bump 2011-10-03 11:19:56 +01:00
Richard Hughes
b387e1a46b Released UPower 0.9.14 2011-10-03 11:18:33 +01:00
Richard Hughes
52bef2b461 Filter all the debugging details unless --verbose is specified
Now systemd is pushing all our debugging to syslog, we're upsetting some people.
2011-09-28 16:13:20 +01:00
Richard Hughes
fe643d6fc0 trivial: remove an overzealous warning when starting up 2011-09-28 16:12:40 +01:00
Christian Seiler
ff23a9c6e2 Fix linux up_backend_supports_sleep_state() return code.
Under Linux, regardless of the exit code of /usr/bin/pm-is-supported, it will
always set CanSuspend and CanHibernate to true due to a logic error in
up_backend_supports_sleep_state in src/linux/up-backend.c: The 'ret' variable
is re-used for the return code without being re-initialized to false after the
call to g_spawn_command_line_sync.

Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2011-09-22 17:34:45 +02:00
Pino Toscano
626c087b48 Fix the kFreeBSD detection
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-09-08 15:35:14 +01:00
Richard Hughes
e2e8dd9603 Add the website sources to git
In the case of a hit-by-a-bus event...
2011-09-06 10:02:04 +01:00
Richard Hughes
0e0333a6c8 trivial: post release version bump 2011-09-05 13:53:25 +01:00
Richard Hughes
9fc12b37b6 Released UPower 0.9.13 2011-09-05 13:52:05 +01:00