Commit graph

1282 commits

Author SHA1 Message Date
Christian Kellner
215049e7b8 Released UPower 0.99.10 2019-02-20 14:40:19 +01:00
João Paulo Rechi Vita
c4e561f54d integration-test: Test mapping pending-charge to fully-charged 2018-12-18 17:19:01 -08:00
João Paulo Rechi Vita
a953401420 linux: Map pending-charge to fully-charged when charge is 100%
Some devices report "Not charging" when the battery is full and AC power
is connected. In this situation we should report fully-charged instead
of pending-charge.

Closes: #86.
2018-12-18 17:17:32 -08:00
João Paulo Rechi Vita
888c9121f0 linux: Don't set out_state before state is final
Currently up_device_supply_refresh_battery sets out_state before the
state value is definitive, so the wrong state value is returned to the
caller. Luckily the only caller does not make use of this value at the
moment, so there are no user-visible consequences. Nonetheless this is a
bug, so this commit fixes it.
2018-12-18 17:16:49 -08:00
João Paulo Rechi Vita
f3f4c6e0b4 integration-test: Test DisplayDevice pending-charge
Test relaying the pending-charge state to the DisplayDevice. This commit
adds three tests: only one battery pending-charge, one battery
pending-charge and another one discharging, and one battery
pending-charge and another one charging.
2018-11-14 12:57:15 -08:00
João Paulo Rechi Vita
eb02827015 integration-test: Define PENDING_CHARGE and PENDING_DISCHARGE states
Add definitions for UP_DEVICE_STATE_PENDING_CHARGE and
UP_DEVICE_STATE_PENDING_DISCHARGE.
2018-11-14 12:57:15 -08:00
João Paulo Rechi Vita
a074631c0b daemon: Consider pending-charge when calculating the display state
Without this change if all batteries in the system are in the
pending-charge state, the display device state is set to unknown, and
its icon to battery-missing-symbolic.

This change makes the pending-charge state be considered when
calculating the DisplayDevice state, setting it to pending-charge if at
least one battery in the system is pending-charge and no other is
charging or discharging.

Closes: #81
Closes: #19
2018-11-14 12:57:09 -08:00
João Paulo Rechi Vita
a074a5462a daemon: Make comment more succinct
This will help make it more clear when adding an extra state on the
following commit. It also makes the language consistent between the
different lines. There are no changes on the meaning of these lines nor
any functional changes on this commit.
2018-11-14 12:21:36 -08:00
Bastien Nocera
59faabc3c2 0.99.9 2018-10-25 13:36:36 +02:00
Bastien Nocera
52dcda8c73 ci: Run distcheck as a test 2018-10-25 13:12:35 +02:00
Bastien Nocera
8913f60347 doc: Fix dist not working
automake's documentation says that it works depth-first, but it doesn't
actually go depth first when dist'ing a directory. So our .ref.xml files
aren't generated when we try to get them added to the dist.

Fix this with a big hammer by moving the generation to the current
directory, rather than spending any more time working with automake.
Can't wait for the meson port.
2018-10-25 13:12:35 +02:00
Bastien Nocera
7c17075ac0 build: Fix up-daemon-generated.h not being found on distcheck 2018-10-25 13:12:35 +02:00
Laurent Bigonville
2f4df9174e src/linux/up-device-hid.c: usage_code is defined as an unsigned integer
Also define "value" as a signed 32 bits integer
2018-10-25 11:52:06 +02:00
Bastien Nocera
0980b2dd40 docs: Mention to try and not use IconName when possible
See https://gitlab.freedesktop.org/upower/upower/merge_requests/16#note_41003
2018-10-02 10:48:07 +02:00
Bastien Nocera
0a9d9ab494 daemon: Fix upower's keyboard backlight support
Disabling kernel tunables blocked us from accessing /sys, meaning we
couldn't change keyboard backlight levels.

Closes: #73
2018-10-02 10:18:20 +02:00
Bastien Nocera
fe7726acef build: Build upower out-of-tree
So that this particular setup is tested.
2018-10-02 10:18:04 +02:00
Bastien Nocera
feac865366 test: Fix up-self-test crash during out-of-tree builds
When the layout of the build tree doesn't match the expectations in
up-self-test, the test would crash failing to find UPower.conf. Pass the
path as a macro during build so we always know where it is.
2018-10-02 10:18:04 +02:00
Bastien Nocera
ca2174aa3f build: Fix out-of-tree build
The generated headers for the dbus service are in the build dir, not
the source dir.

../../libupower-glib/up-client.c:39:10: fatal error: up-daemon-generated.h: No such file or directory
 #include "up-daemon-generated.h"
          ^~~~~~~~~~~~~~~~~~~~~~~
2018-10-02 10:18:04 +02:00
Bastien Nocera
ff31184186 build: Add missing python3-dbus package to CI 2018-10-02 10:17:14 +02:00
Bastien Nocera
fe356951a9 daemon: Fix upower not having access to udev events
PrivateNetwork=true will cut off upower from the udev netlink socket, so
it's not what we want to use, as we want those events.

See https://lists.freedesktop.org/archives/systemd-devel/2018-July/041000.html

Closes: #68
2018-10-02 10:17:14 +02:00
Guido Günther
5ffcb1c269 lib: UpClient: up_client_get_display_device returns a UpDevice
It doesn't return a UpClient.
2018-09-30 19:19:02 +02:00
Guido Günther
afdf4f9919 lib: UpClient: Fix stray '%' 2018-09-30 19:19:02 +02:00
Guido Günther
409b2ccc89 lib: Use @see_also instead of "See also"
This ensures consistent rendering.

See https://developer.gnome.org/gtk-doc-manual/stable/documenting_sections.html.en
2018-09-30 19:19:02 +02:00
Guido Günther
0c180d044f lib: Work-around to fix gtk-doc's type detection
Without the braces on the same line gtk-doc adds function pointers as
functions to the documentation and fails to detect the types as
GObjects. This fixes object names in the index and cross refs.

See the examples in

https://developer.gnome.org/gtk-doc-manual/stable/documenting_symbols.html.en
2018-09-30 19:18:35 +02:00
Guido Günther
3167b97d88 build: gtk-doc: Rebuild types and sections
This makes sure we stay up to date and get the object hierarchy
generated.
2018-08-22 13:46:35 +02:00
Bastien Nocera
6d8eb75464 0.99.8 2018-06-19 15:40:14 +02:00
Bastien Nocera
1c9892d763 linux: Add test for MacBook uevent behaviour
See https://gitlab.freedesktop.org/upower/upower/issues/56
2018-06-19 13:01:52 +00:00
Bastien Nocera
7188cc0417 linux: Refresh for 5 seconds after plug/unplug on MacBooks
Pull the 2 previous changes together to refresh the battery status for a
couple of seconds after receiving an event on the power line. This fixes
charge status being inaccurate for up to 120 seconds (the normal poll
timeout on MacBooks).

https://gitlab.freedesktop.org/upower/upower/issues/56
2018-06-19 13:01:52 +00:00
Bastien Nocera
6ab61bac9d linux: Detect hardware that needs more polling after event
When an event happens on the power line, and we are using a particular
device (in this case a MacBook or MacBookAir), we might need to poll
more aggressively after the event.

This adds a function to detect and export this.
2018-06-19 13:01:52 +00:00
Bastien Nocera
79017e432d linux: Make sure unknown poll lasts 5 seconds
Rather than 5 calls to up_device_supply_setup_unknown_poll(), which
can happen pretty quickly together after receiving a uevent.
2018-06-19 13:01:52 +00:00
Bastien Nocera
054cb3f4b8 linux: Fix possible double-close on exit
Fix double-close on exit. If we created a GIOChannel from the file
descriptor, then g_io_channel_shutdown() will close that file descriptor
as well. Close the channel first, so that the file descriptor is only
closed manually if we didn't manage to create a GIOChannel from it.

https://gitlab.freedesktop.org/upower/upower/issues/60
2018-06-19 12:48:39 +00:00
Bastien Nocera
0e51436b4b Merge branch 'wip/hadess/add-ci' into 'master'
build: Add CI

See merge request upower/upower!9
2018-06-19 12:41:14 +00:00
Bastien Nocera
e99877b809 build: Add CI 2018-06-19 14:35:01 +02:00
Bastien Nocera
c937dabd1e linux: Clean up after running test suite in "distcheck"
Don't leave the history files installed when running "make uninstall".
Those files will likely have been created by the test suite when running
"make distcheck"
2018-06-18 18:21:55 +02:00
Bastien Nocera
21dcc00cdb linux: Remove extra linefeed 2018-06-18 17:45:40 +02:00
Bastien Nocera
c4ca520f24 linux: Better error reporting from sysfs_get_double_with_error()
sysfs_get_double_with_error() used to return -1.0 for errors, but in
some cases, we might want -1.0 to be a valid value, such as for negative
discharge rates. Return FALSE on error instead.
2018-06-18 17:45:40 +02:00
Richard Hughes
041e70867f Add COMMITMENT file as part of GPL Common Cure Rights Commitment
This is part of more broader commitment Red Hat along with IBM, Google, and
Facebook made in November 2017.

More on this can be found online:

https://www.redhat.com/en/blog/fostering-greater-open-source-development &
https://www.redhat.com/en/about/gplv3-enforcement-statement
2018-06-18 16:11:43 +01:00
Richard Hughes
49af045fa9 Merge branch 'get-devices-unref' into 'master'
lib: Add a new version of up_client_get_devices which unrefs contents

See merge request upower/upower!1
2018-06-05 13:02:27 +00:00
Robert Ancell
cb1071b9ab lib: Add a new version of up_client_get_devices which unrefs contents
The existing function didn't set the free function on the GPtrArray.
This means a libupower user can easily make a mistake in the reference
counting of the array contents.
2018-05-31 09:42:56 +12:00
Bastien Nocera
0e6cc20ca9 lib: Mention that battery level is preferred when present
And print "should be ignored" next to the percentage.

https://bugs.freedesktop.org/show_bug.cgi?id=97484
2018-04-19 03:40:40 +02:00
Bastien Nocera
096121740f linux: Add a test for Logitech HID++ charging states
The current power_supply support in the kernel will advertise an unknown
capacity when a device is being charged. This tests this state as well
as the expected behaviour when the device is fully charged.

https://bugs.freedesktop.org/show_bug.cgi?id=97484
2018-04-19 03:40:40 +02:00
Bastien Nocera
e7de44f0d5 daemon: Add battery-level specific icons
Rather than relying on the percentage equivalence, which just doesn't
work for "Unknown" battery levels.

https://bugs.freedesktop.org/show_bug.cgi?id=97484
2018-04-19 03:27:12 +02:00
Bastien Nocera
33e9039eb0 linux: Add support for "Unknown" capacity level
Rather than leaving the percentage untouched, set the battery level at
50.0 as a "middle-ground".

This percentage is supposed to be ignored if a BatteryLevel is set so
this is better than showing "0%" which makes it look like a bug.

https://bugs.freedesktop.org/show_bug.cgi?id=97484
2018-04-19 03:11:29 +02:00
Bastien Nocera
0840bb266e linux: Add a README with a couple of debugging commands 2018-04-18 16:34:42 +02:00
Bastien Nocera
a3c58db735 lib: Simplify resource destruction
Use g_clear_pointer() and g_clear_object() when possible.
2018-04-18 12:45:51 +02:00
Bastien Nocera
b0cdb7e9fe daemon: Lock down systemd service file
Use systemd's service file to lockdown the UPower daemon to stop
eventual security problems.

https://bugs.freedesktop.org/show_bug.cgi?id=102898
2018-04-16 10:04:51 +02:00
Dmitry Torokhov
40e525edbd linux: lower severity of "unhandled action" messages
Newer kernels emit bind/unbind uevents that are not of interest to
powerd. To avoid littering logs with scary messages, let's lower their
severity to "debug".

https://bugs.freedesktop.org/show_bug.cgi?id=106018
2018-04-12 22:34:30 +02:00
Bastien Nocera
17dba403e7 linux: Fix memory leak if logind returns an error 2018-04-12 22:34:04 +02:00
Bastien Nocera
c68daf665f linux: Fix crash if logind doesn't return an error
For example, when using an incomplete mock logind.
2018-04-12 22:32:13 +02:00
Martin Szulecki
598fdbc5e0 linux: Check "HasBattery" key for newer iOS versions
This adds an extra check to query if the iOS device has a
battery at all before actually trying to retrieve the battery
status. Should still work for older iOS versions which do not
provide this key.

https://bugzilla.freedesktop.org/show_bug.cgi?id=105625
2018-03-20 15:28:36 +01:00