Commit graph

1082 commits

Author SHA1 Message Date
Peter Wu
b3e5143f5a hidpp-device: avoid unaligned memory access
Fixes a -Wcast-align warning and a -fsanitize=undefined error.

https://bugs.freedesktop.org/show_bug.cgi?id=71079
2014-11-18 19:47:40 +01:00
Peter Wu
5eead9ecf6 daemon: remove unused variable
Introduced in 2e87407eb9

https://bugs.freedesktop.org/show_bug.cgi?id=86144
2014-11-18 11:32:38 +01:00
Bastien Nocera
2e87407eb9 daemon: Use new warning update helper function
Rather than the copy/paste code in commit:
b9bd275890387fb35c185f37ec0ea1f2aa857818

This makes sure that the AC status is updated.

https://bugs.freedesktop.org/show_bug.cgi?id=86144
2014-11-14 23:09:14 +01:00
Bastien Nocera
83ebd3eccb daemon: Update display device when battery is removed
When removing a battery, make sure to go through the batteries, and
update the display device status.

https://bugs.freedesktop.org/show_bug.cgi?id=86144
2014-11-14 23:09:13 +01:00
Bastien Nocera
4fdb9cee21 daemon: Split out updating on_battery and warning_level
So that we can reuse this code.

https://bugs.freedesktop.org/show_bug.cgi?id=86144
2014-11-14 23:09:12 +01:00
Nikolay Martynov
3a5f3e5526 upowerd: Fix cleanup in up_device_idevice_coldplug/finalize
Under certain conditions lockdownd_client_free was called
twice for same client. This caused SIGSEGV.

This patch addresses this issue

Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
Signed-off-by: Richard Hughes <richard@hughsie.com>
2014-10-08 19:36:18 +01:00
Evangelos Foutras
6864699209 daemon: Update aggregate device on battery removal
https://bugs.freedesktop.org/show_bug.cgi?id=84345

Signed-off-by: Richard Hughes <richard@hughsie.com>
2014-10-08 19:34:16 +01:00
Evangelos Foutras
bbe15b14de all: convert value from g_get_real_time() to seconds
Commit 5ddfe0d (all: Use g_get_real_time() when possible) replaced calls
to g_get_current_time() with g_get_real_time(), however, we also need to
convert the return value from microseconds to seconds.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2014-10-08 19:32:05 +01:00
Bastien Nocera
5ddfe0dba1 all: Use g_get_real_time() when possible
Instead of a call to g_get_current_time().
2014-09-24 15:16:11 +02:00
Bastien Nocera
8271045a68 daemon: Set update-time on the aggregate device 2014-09-24 15:16:11 +02:00
Eric Koegel
1a8ccbcefc Correct check to prevent the display of invalid ASCII codes
Cppcheck found it as a logical conjunction always evaluates to
false: EXPR < 32 && EXPR > 126. Change the expression to an Or.
https://bugs.freedesktop.org/show_bug.cgi?id=71066

Signed-off-by: Richard Hughes <richard@hughsie.com>
2014-09-16 10:34:42 +01:00
Eric Koegel
33a3af8008 Fencepost array access error
Array 'temp_data[100]' accessed at index 100, which is out of
bounds.
https://bugs.freedesktop.org/show_bug.cgi?id=71066

Signed-off-by: Richard Hughes <richard@hughsie.com>
2014-09-16 10:33:56 +01:00
Eric Koegel
081c35a36c Bump GLib min req to 2.34
UPower uses g_clear_pointer several places in the code, but is
available starting in 2.34. Update UPowers minimum version to
match.
https://bugs.freedesktop.org/show_bug.cgi?id=83850

Signed-off-by: Richard Hughes <richard@hughsie.com>
2014-09-16 10:31:51 +01:00
Bastien Nocera
6573310637 linux: Respect the CriticalPowerAction config option
It was documented, but the configuration was never actually read.

https://bugs.freedesktop.org/show_bug.cgi?id=82925
2014-09-02 21:56:38 +02:00
Bastien Nocera
07fa35c42b daemon: Add helper to get string from config
https://bugs.freedesktop.org/show_bug.cgi?id=82925
2014-09-02 21:56:38 +02:00
Martin Pitt
90082ec5d4 Linux integration tests: Split big tests into several smaller ones
This is better design to catching regressions and problems in a more
pin-pointed fashion. This also avoids having to restart the umockdev testbed
due to changing the environment variables with stop/start_daemon().
2014-09-02 18:43:33 +02:00
Martin Pitt
01ab81233f Linux integration tests: Fix error handling for Python 3.4
Python 3.4 changed the TestCase._outcome semantics, adjust accordingly.
2014-09-02 17:19:08 +02:00
Martin Pitt
e5bd3e80f3 Linux integration tests: Fix crash if there is no session D-BUS
This can happen in CI environments without a desktop session.
2014-09-02 15:57:09 +02:00
Richard Hughes
0b50cef90c trivial: post release version bump 2014-08-18 13:10:03 +01:00
Richard Hughes
4f74e297e4 Released UPower 0.99.1 2014-08-18 13:08:48 +01:00
Alexander Jesner
47c6974fc0 Free the obtained device list array after use
Signed-off-by: Richard Hughes <richard@hughsie.com>
2014-08-18 12:49:41 +01:00
Martin Pitt
e4ad754351 doc: Adjust documentation for polkit removal 2014-07-16 12:19:38 +02:00
Martin Pitt
3b6948bc4b self-test: Add missing #include
up-self-test.c: In function ‘up_test_history_func’:
up-self-test.c:274:2: warning: implicit declaration of function ‘rmdir’ [-Wimplicit-function-declaration]
  rmdir (history_dir);
2014-07-16 11:45:35 +02:00
Martin Pitt
bddc559713 Remove polkit tests
Complete the polkit dependency removal by also dropping it from the self tests.
Unbreaks build and up-self-test again.
2014-07-16 11:43:57 +02:00
Eric Koegel
9a2b263309 Remove polkit dependency
With the removal of the suspend/hibernate code, there's no longer
a need for upower to depend on polkit. This patch removes the old
polkit code.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2014-07-14 19:34:46 +01:00
Fabian Raetz
d1bb06985f openbsd: Expose "capacity" and "energy-full-design" properties
https://bugs.freedesktop.org/show_bug.cgi?id=80707
2014-06-30 12:09:19 +02:00
Bastien Nocera
b1aeed9948 daemon: Fix possible UpHistoryItem leak on failure 2014-06-24 16:45:38 +02:00
Bastien Nocera
bab2431c1e linux: Simplify list freeing 2014-06-24 16:41:48 +02:00
Bastien Nocera
dbb9bead6d linux: Fix small memleak on startup with Logitech devices 2014-06-24 16:35:06 +02:00
Richard Hughes
969c97426a Do not print a critical warning when misusing up_device_set_object_path_sync() 2014-05-20 13:25:17 +01:00
Bastien Nocera
5ed25a7e5f all: Remove IsDocked property
Removes the deprecated (for not very long) property, before we do a 1.0
release.

https://bugs.freedesktop.org/show_bug.cgi?id=78380
2014-05-07 11:01:27 +02:00
Bastien Nocera
e8beb269df tools: Remove is-docked from up-tool 2014-05-07 09:48:44 +02:00
Bastien Nocera
cfbd05deb3 linux: Remove is_docked from the integration test 2014-05-07 09:47:45 +02:00
Bastien Nocera
212b4397cc lib: Fix API doc for up_client_get_on_battery() 2014-05-07 09:46:49 +02:00
Bastien Nocera
54a030a38d lib: Hard-code the IsDocked value 2014-05-07 09:46:08 +02:00
Bastien Nocera
135339acc1 daemon: Deprecate "IsDocked" property
The IsDocked property has been incorrect for a number of laptops for a
while, as it thought that laptops with hybrid graphics cards were always
docked.

The alternative would have been to use the platform/dock_station
devices, but those are only exported for ACPI docking stations.

Instead, whether an external display is attached (which isn't really
docking) should be checked in the same place where the policy depending
on the value should be applied, such as gnome-settings-daemon.

https://bugs.freedesktop.org/show_bug.cgi?id=36818
2014-05-07 09:27:24 +02:00
Bastien Nocera
dbf7eb7e55 daemon: Fix shutdown on boot on some machines
On the Lenovo A600 all-in-one, there's a HCI/HID dual-mode Broadcom
device which will try to get the battery level of the supplied
mouse and keyboard, but will usually fail to do so.

So we have a battery of type "battery" (it's not either a mouse or
a keyboard, as it's supposed to handle both) but our display device
battery code doesn't check whether those batteries are power supplies
or not, using this "empty" (0% after the check timed out) battery in
the shutdown policy.

Check better for power supply devices, not all the "battery" types
are power supply batteries, they might be non-power supply ones
from unknown device types.
2014-04-23 15:48:48 +02:00
Bastien Nocera
d650df8af8 lib: Fix typo in g-i annotation
Missing colon.
2014-04-23 15:48:48 +02:00
Jasper Lievisse Adriaanse
4bed9c99c1 Update lid status when updating ac status.
Signed-off-by: Richard Hughes <richard@hughsie.com>
2014-04-22 11:41:56 +01:00
Cosimo Cecchi
b9cff29978 Create the history directory at runtime
In addition to build time - this increases compatibilty with OSTree,
which starts out with an empty /var.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2014-02-25 09:43:04 +00:00
Martin Pitt
0d64bbddaa lib: Fix segfault on getting property when daemon is not running
This fixes "upower --version" when the daemon is not running, and thus the
client proxy is NULL.
2013-11-08 14:59:50 +01:00
Richard Hughes
e96f5349f9 trivial: post release version bump 2013-10-29 12:52:47 +00:00
Richard Hughes
9b28dac1a1 Released UPower 0.99.0 2013-10-29 12:51:34 +00:00
Richard Hughes
97ed6c4731 trivial: Fix a compile warning in the linux backend 2013-10-29 12:51:23 +00:00
Bastien Nocera
e673d9e59b linux: Use daemon poll for batteries too
This has 2 effects:
- we never stop polling (we used to stop polling when the
  battery was marked as fully-charged, but that can happen when
  the battery is discharging too)
- when in an unknown state, we will poll through the daemon,
  and through our unknown poll. This isn't a problem as there'll
  another 115 seconds of wait until we get to poll through the
  daemon again.
2013-10-28 16:28:57 +01:00
Bastien Nocera
03591e6e05 linux: Switch non-battery devices to use the new daemon poll
Next up is doing this for batteries, which need to switch between
a normal/slow poll to a faster one when the battery state is unknown.
2013-10-28 15:15:02 +01:00
Bastien Nocera
d1032c562a linux: Switch Unifying devices to use the new daemon poll 2013-10-28 15:15:02 +01:00
Bastien Nocera
988889121e linux: Switch iDevices to use the new daemon poll
And remove the gathering of the battery poll from the device
itself, it's of nearly no use.
2013-10-28 15:15:02 +01:00
Bastien Nocera
8018418a97 linux: Switch CSR devices to use the new daemon poll 2013-10-28 15:15:02 +01:00
Bastien Nocera
b7d69524e8 daemon: Add poll helper functions
To be used by all polling backends. This changes the defaults
to poll every 120 seconds when a warning level isn't reached, and
switch automatically to 30 seconds poll when the battery level is low.
2013-10-28 15:15:02 +01:00