Commit graph

759 commits

Author SHA1 Message Date
Cosimo Cecchi
6a8aeafc51 daemon: port UpKbdBacklight to GDBus 2015-07-29 13:37:11 +01:00
Cosimo Cecchi
7258c4cce0 up-backend: remove unused private member 2015-07-29 13:37:11 +01:00
Bastien Nocera
1e4f711df4 Revert "linux: Work-around broken battery on the Onda v975w"
This reverts commit 31b2b8ec78.

A better work-around has been found kernel-side:
https://bugzilla.kernel.org/show_bug.cgi?id=83941

We'll need to add some code to ignore the incorrect "time left" values
though.
2015-07-16 11:26:17 +02:00
Eric Koegel
77239cc447 bsd: Add critical action support for *BSD
This patch adds support for using ConsoleKit2's DBUS API to
implement the critical action for FreeBSD and OpenBSD. It does so
by creating a common backend file both can use to implement the
API calls.

https://bugs.freedesktop.org/show_bug.cgi?id=85242
2015-07-07 17:10:38 +02:00
Bastien Nocera
c9b2e17726 linux: Fix possible double-free
When reopening the lockdown daemon with upower as the client, don't
double-free if the user says "No" to trusting the laptop.

https://bugzilla.redhat.com/show_bug.cgi?id=1231763
2015-06-26 14:07:13 +02:00
Marc Deslauriers
6c706ff033 linux: Properly detect bluetooth mice and keyboards that are HID devices
https://bugs.freedesktop.org/show_bug.cgi?id=90222
2015-05-20 14:56:27 +02:00
Bastien Nocera
31b2b8ec78 linux: Work-around broken battery on the Onda v975w
Until https://bugzilla.kernel.org/show_bug.cgi?id=83941 is fixed,
this allow to have a bit more information than "0% battery" displayed in
the UI.

https://bugs.freedesktop.org/show_bug.cgi?id=90214
2015-04-28 13:19:48 +02:00
Bastien Nocera
abaf635ce4 linux: Use CLAMP() instead of a series of ifs 2015-04-28 13:01:11 +02:00
Bastien Nocera
f3706d7a29 linux: More memory handling fixes in iDevice
We could crash if up_device_idevice_refresh() failed during
start_poll_cb().
2015-02-03 23:20:26 +01:00
Bastien Nocera
a410c26991 linux: Bail out when iDevice state is malformed
If there's no BatteryCurrentCapacity value, we've failed updating
the device.
2015-02-03 23:07:31 +01:00
Bastien Nocera
e37fcd1db1 linux: Defer getting iDevice info until ready
We're a bit too fast for usbmuxd to have noticed the USB device getting
plugged in, so defer until either the device is 1) noticed by usbmuxd
and 2) paired.

https://bugs.freedesktop.org/show_bug.cgi?id=88950
2015-02-03 23:07:31 +01:00
Peter Wu
9639487d4e daemon: fix ulong/gulong typo
Regression in 4221835fae ("daemon:
properly disconnect signals, stop memleak").

https://bugs.freedesktop.org/show_bug.cgi?id=82659

Signed-off-by: Richard Hughes <richard@hughsie.com>
2014-12-03 17:31:59 +00:00
Peter Wu
2199a9b0b5 daemon: fix dbus proxy leak on shutdown
Fixes leaking some DBus objects on shutdown, causing noise in
gobject-list and valgrind logs.

https://bugs.freedesktop.org/show_bug.cgi?id=82659
2014-11-26 11:56:17 +00:00
Peter Wu
90994b0d81 daemon: release resources at shutdown
This makes it easier to find real memory leaks with valgrind. After
calling the up_backend_unplug functions, you cannot restart it with
up_backend_coldplug since the lists are cleared.

Tested with Linux only (not on *BSD; dummy compiles).

https://bugs.freedesktop.org/show_bug.cgi?id=82659
2014-11-26 11:56:16 +00:00
Peter Wu
a91d03a3a9 daemon: fix various reference leaks
up_daemon_get_daemon takes a reference on UpDaemon, so it must be
properly dereferenced. Similar for up_daemon_get_devices_list which
references an UpDeviceList.

The display device was allocated in init, but never released either.

https://bugs.freedesktop.org/show_bug.cgi?id=82659
2014-11-26 11:56:15 +00:00
Peter Wu
4221835fae daemon: properly disconnect signals, stop memleak
Whenever the daemon is polling on a device, a new signal is connected to
the object. This signal was not disconnected when polling stops which
resulted in a memory leak. Furthermore, whenever the "warning-level"
property is updated, the signal would result in an exponentially raising
call count (this happens when the battery percentage changes for
example).

https://bugs.freedesktop.org/show_bug.cgi?id=82659

Reported-by: Alexander Jesner <alexander@jesner.eu>
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-11-26 11:56:13 +00:00
Peter Wu
1f9c094119 hidpp: fix memleak for each Feature
The name of each Logitech HID++ 2.0 Feature will now be freed.

https://bugs.freedesktop.org/show_bug.cgi?id=82659
2014-11-26 11:56:12 +00:00
Peter Wu
73927044cb daemon: fix memleak in org.freedesktop.UPower.Wakeups.GetData
up_wakeups_get_cmdline returns allocated memory and
up_wakeup_item_set_cmdline duplicates it. Therefore free the former
after setting it on the item.

https://bugs.freedesktop.org/show_bug.cgi?id=82659
2014-11-26 11:56:10 +00:00
Peter Wu
d1971e4d16 daemon: plug huge memleak in GetStatistics
Reproducible by executing `upower -d` or by calling the DBus method
org.freedesktop.UPower.Device.GetStatistics(charging).
up_device_get_statistics ->
  up_history_get_profile_data ->
    up_stats_item_new.

https://bugs.freedesktop.org/show_bug.cgi?id=82659
2014-11-26 11:56:09 +00:00
Peter Wu
8988f06986 daemon: fix memleaks in GetStatistics and GetHistory
dbus_g_method_return[_error] does not claim the passed parameters, the
caller must free it theirselves.

complex is filled with an GValueArray pointer (see
UP_DBUS_STRUCT_DOUBLE_DOUBLE) but its contents are not freed (memleak!).
This patch introduces a deprecation warning due to the use
g_value_array_free, but since UP_DBUS_STRUCT_DOUBLE_DOUBLE is a
GValueArray, this is unavoidable.

https://bugs.freedesktop.org/show_bug.cgi?id=82659
2014-11-26 11:56:08 +00:00
Peter Wu
f3dfc1ea83 daemon: fix memleak in queue_changed_property
The control of value is transferred to up_daemon_queue_changed_property,
let it release the memory when an error occurs.

https://bugs.freedesktop.org/show_bug.cgi?id=82659
2014-11-26 11:56:07 +00:00
Peter Wu
71cbf8dfb9 linux: fix memleak when reading critical action
g_variant_get for string types must be freed as documented at
https://developer.gnome.org/glib/stable/gvariant-format-strings.html#gvariant-format-strings-strings
Since we just want to compare it, use a pointer as documented at
https://developer.gnome.org/glib/stable/gvariant-format-strings.html#gvariant-format-strings-pointers

https://bugs.freedesktop.org/show_bug.cgi?id=82659
2014-11-26 11:56:05 +00:00
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
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
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
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
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
cfbd05deb3 linux: Remove is_docked from the integration test 2014-05-07 09:47:45 +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