Commit graph

530 commits

Author SHA1 Message Date
Bastien Nocera
4292226e5c linux: Fix compilation warning
duplicate ‘const’ declaration specifier

We can't use a const char const because we actually want to assign
values to elements of the array.
2017-03-24 15:46:40 +01:00
Bastien Nocera
4be1efe819 integration-test: HID++ mouse is a mouse 2017-03-24 15:19:12 +01:00
Bastien Nocera
12d34b8a8b Revert "linux: Disable crashing test"
This reverts commit 8aff086b48.

The crash is fixed in umockdev 0.8.13
2017-01-26 11:35:34 +01:00
Bastien Nocera
1de37eb958 linux: Get a serial number for device batteries
And not just for batteries that power the machine itself.
2017-01-24 18:08:52 +01:00
Bastien Nocera
d5c05515a8 linux: Add a serial number to mouse battery test
Which will fail, as the device code doesn't even try to get a serial
number.
2017-01-24 18:08:24 +01:00
Bastien Nocera
efe589a8ce linux: Add a test for HID++ devices 2017-01-24 17:48:47 +01:00
Bastien Nocera
d47f3eb84b linux: Simplify getting the device type
1) Get the sibling device
2) Check its type

This fixes the test_bluetooth_hid_mouse_no_legacy_subdevice test.
2017-01-24 17:45:58 +01:00
Bastien Nocera
8aff086b48 linux: Disable crashing test
Filed as an issue against umockdev:
https://github.com/martinpitt/umockdev/issues/53
2017-01-24 17:45:58 +01:00
Bastien Nocera
f711bc3865 linux: Always stop daemon when started in tests 2017-01-24 17:45:58 +01:00
Bastien Nocera
c5d1660b5c linux: Allow running upowerd under valgrind in tests 2017-01-24 17:45:58 +01:00
Bastien Nocera
caf53bd982 linux: Parent the keyboard device correctly in tests 2017-01-24 17:45:58 +01:00
Bastien Nocera
89a3baad69 linux: Add test without the "mouse" legacy node
Which currently fails. Which is what will happen with an older UPower on
a newer kernel with that removed.
2017-01-24 17:45:58 +01:00
Bastien Nocera
e8e20ac64a linux: Parent Bluetooth mouse test devices properly 2017-01-24 17:45:58 +01:00
Bastien Nocera
e3b6e1426b linux: Simplify up_device_supply_guess_type()
By exiting early.
2017-01-24 17:45:58 +01:00
Bastien Nocera
140b18f8f4 linux: Remove unneeded goto 2017-01-24 17:45:58 +01:00
Bastien Nocera
5b217179be linux: Split off device type detection
The code is far too deep to be left in this function, let's split it
off to make it more readable.
2017-01-24 17:45:58 +01:00
Bastien Nocera
f0ec467d00 linux: Move declaration of variables closer to use
Will make it easier to move to a separate function.
2017-01-24 12:59:43 +01:00
Bastien Nocera
402640bee0 linux: Lower initial power usage when iDevice isn't accessible
When starting up, we would try to connect to the iDevice repeatedly,
once a second. But the process takes between a quarter and half a
second, and is CPU heavy. Lower this timeout to once every 5 seconds to
reduce the initial CPU consumption.
2016-06-08 14:50:23 +02:00
Bastien Nocera
54dd83501a linux: Add better debug for iDevice startup poll 2016-06-08 14:47:25 +02:00
Bastien Nocera
377dd73424 linux: Name the iDevice start poll timeout 2016-06-08 14:22:32 +02:00
Bastien Nocera
c015e6b21e linux: Fix deprecation warning in integration-test 2015-09-23 16:14:40 +02:00
Bastien Nocera
b6dfa473f8 build: Fix missing includes
Include $(top_builddir) when building so that we can find the newly
generated D-Bus helper files. Note that, because we ship generated files
in the tarball, we'll also need to include $(top_srcdir).
2015-09-23 16:09:50 +02:00
Cosimo Cecchi
16537df546 daemon: remove custom marshal setup
Just use the default marshaller.
2015-07-29 13:38:13 +01:00
Cosimo Cecchi
da7517137e integration-test: fix typo in interface name
The display device will use the org.freedesktop.UPower.Device interface,
not org.freedesktop.UPower.
2015-07-29 13:37:11 +01:00
Cosimo Cecchi
b549d8928b build: remove dependency on dbus-glib and libdbus
Nothing depends on it any more.
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
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
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
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
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
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
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
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
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
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
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
cfbd05deb3 linux: Remove is_docked from the integration test 2014-05-07 09:47:45 +02:00