Commit graph

1169 commits

Author SHA1 Message Date
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
937760f491 linux: Don't talk to HID++ devices ourselves
If the kernel already extract the battery information out of them.
2017-01-23 15:27:33 +01:00
Bastien Nocera
3e06274e00 daemon: Remove unused test declarations
All those test functions were removed in 6ba8629 and are now unused.
2016-07-08 18:51:14 +02: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
4b03777c54 build: Fix -Wformat-y2k compilation errors
The strings are user visible strings, so this isn't a y2k problem.
2016-06-08 14:14:24 +02:00
Marco Trevisan (Treviño)
71e3bb02f9 UpKbdBacklight: don't check the *end value when using g_ascii_strtoll
g_ascii_strtoll would set end to match buf when a parsing error occurred,
so there's no reason to also check what this is pointing to

https://bugs.freedesktop.org/show_bug.cgi?id=96215
2016-05-25 18:37:52 +02:00
Marco Trevisan (Treviño)
793642bfb7 UpKbdBacklight: don't cache the brightness level, always read it from sysfs attrib
When GetBrightness is called it's better to fetch the current value in the
sysfs attribute since many devices doesn't support the emission of brightness
changes to userland, and this could make settings daemons to handle
this value incorrectly.

Add static up_kbd_backlight_brightness_read that is now called during
initialization too, it returns -1 on errors, and use it everywhere we need
to read or check the current brightness.

https://bugs.freedesktop.org/show_bug.cgi?id=95457
2016-05-24 11:18:19 +02:00
Martin Pitt
29c5c85f6b lib: Remove hidden singleton instance
GObject _new constructors should always return a new pointer and not do
anything else than g_{object,initable}_new(). Drop the internal
up_client_object singleton instance.

This simplifies the code and makes the code robust with multiple threads.

Side issue in https://bugs.freedesktop.org/show_bug.cgi?id=95350
2016-05-18 14:59:12 +02:00
Martin Pitt
4e83fabac1 up-tool: Exit early when connecting to upower fails
This avoids spewing dozens of assertions like

   libupower-glib-CRITICAL **: up_client_get_devices: assertion 'UP_IS_CLIENT (client)' failed
   libupower-glib-CRITICAL **: up_device_get_object_path: assertion 'UP_IS_DEVICE (device)' failed

and useless default values and then exiting successfully (which might confuse
users or scripts trying to parse the output).

Use the new up_client_new_full() constructor so that we get a proper GError.

Side issue in https://bugs.freedesktop.org/show_bug.cgi?id=95350
2016-05-18 14:58:53 +02:00
Martin Pitt
932a6a39e3 lib: Add proper error and cancellable handling to UpClient constructor
A GObject's _init() should never fail or block, but this is currently the case
as up_client_init() connects to upowerd on D-Bus. Convert this to the GInitable
interface and provide a new constructor up_client_new_full() which accepts a
GCancellable and GError, so that clients can do proper error handling
and reporting.

This changes up_client_new() to return NULL when connecting to upowerd fails.
This provides a more well-defined behaviour in this case as clients can check
for this and our methods stop segfaulting as they have checks like

   g_return_val_if_fail (UP_IS_CLIENT (client), ...)

Previously we returned a valid object, but trying to call any method on it
segfaulted due to the NULL D-Bus proxy, so client code had no chance to check
whether the UpClient object was really valid.

https://bugs.freedesktop.org/show_bug.cgi?id=95350
2016-05-18 14:58:28 +02:00
Martin Pitt
28cee8e284 daemon: fix get_critical_action()
Fix copy&paste error from e7e9156f that called the wrong _complete_ function
for up_daemon_get_critical_action().

https://bugs.freedesktop.org/show_bug.cgi?id=94262
2016-02-23 09:51:07 +01:00
Michael Biebl
b68131796a Update README
Signed-off-by: Richard Hughes <richard@hughsie.com>
2016-02-17 17:01:16 +00:00
Richard Hughes
8f088fa5d7 trivial: post release version bump 2016-02-16 08:48:00 +00:00
Richard Hughes
f9b7e936ec Released UPower 0.99.4 2016-02-16 08:47:05 +00:00
Bastien Nocera
3e49e659d0 daemon: Lower the warning levels for input devices
Modern wireless input devices can last for dozens of minutes, or even
hours with a couple of percentage points of battery, so change the
warning levels to be more in line with that data.

See https://bugzilla.gnome.org/show_bug.cgi?id=756314

https://bugs.freedesktop.org/show_bug.cgi?id=92920
2015-11-12 16:38:45 +01:00
Bastien Nocera
28bd86c181 etc: Update IgnoreLid documentation
It's not used by gnome-settings-daemon any more, logind reads the
Lid status itself.

https://bugs.freedesktop.org/show_bug.cgi?id=92920
2015-11-12 16:38:42 +01:00
Bastien Nocera
db4f9b43df etc: Change the default low battery policy
It is now based on the percentage of battery left, rather than the
usually unreliable "time left". See configuration file for more details.

https://bugs.freedesktop.org/show_bug.cgi?id=92920
2015-11-12 16:37:37 +01:00
Bastien Nocera
057f1bf338 rules: Fix distcheck'ing not being able to install udev rules 2015-09-23 17:18:46 +02:00
Bastien Nocera
34caba2964 daemon: Fix self test config file location for newer automake
More sub-dirs. We should really find a better way to do that in the
future.
2015-09-23 17:08:08 +02:00
Bastien Nocera
d5ec9d4f29 daemon: Print the filename when the config file is missing 2015-09-23 17:00:00 +02:00
Bastien Nocera
c015e6b21e linux: Fix deprecation warning in integration-test 2015-09-23 16:14:40 +02:00
Bastien Nocera
ac8fb3155b build: Always ship upower.service.in
upower.service.in was only shipped if the tarball was built with systemd
support. We always need to ship it.
2015-09-23 16:11:17 +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
Kalev Lember
0825c162d3 Support g_autoptr() for all libupower-glib object types
This allows using e.g. g_autoptr(UpDevice) in other programs, but does
not make upower itself use g_autoptr, or require a new enough glib to
support it.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2015-09-15 12:33:44 +01:00
Arnaud Quette
7371415beb Fix build regression
The removal of dbus-glib and libdbus build dependencies has introduced
a build regression on upower, which fails to link with gobject

Signed-off-by: Richard Hughes <richard@hughsie.com>
2015-08-10 11:06:30 +01:00
Cosimo Cecchi
16537df546 daemon: remove custom marshal setup
Just use the default marshaller.
2015-07-29 13:38:13 +01:00
Cosimo Cecchi
75760c047c daemon: make UpWakeups a subclass of UpExportedWakeupsSkeleton
Simplifies some state tracking.
2015-07-29 13:38:13 +01:00
Cosimo Cecchi
003b5e201b daemon: make UpKbdBacklight a subclass of UpExportedKbdBacklightSkeleton
Simplifies some state tracking.
2015-07-29 13:38:13 +01:00
Cosimo Cecchi
ab4160cad5 daemon: make UpDaemon a subclass of UpExportedDaemon
Simplifies some state tracking.
2015-07-29 13:38:13 +01:00
Cosimo Cecchi
8ad64459be daemon: make UpDevice a subclass of UpExportedDeviceSkeleton
Removes proxying of properties from one object to the other.
2015-07-29 13:38:13 +01:00
Cosimo Cecchi
c108a8e8a4 Share generated code between daemon and library
Since we use the same GDBus code in libupower-glib and the daemon,
auto-generate a private library that can be used by both.
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
e035f23ae0 daemon: port main() to GDBus
We also change the objects to export not to fetch their own bus object.
2015-07-29 13:37:11 +01:00