Commit graph

1260 commits

Author SHA1 Message Date
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
Martin Szulecki
9357aa60e7 linux: Prevent crash after attaching an Apple TV
As Apple TVs do not have a battery and do not provide the
"BatteryIsCharging" lockdown key, upower would crash due to a
missing check whether the retrieved node is actually valid.

https://bugzilla.freedesktop.org/show_bug.cgi?id=105625
2018-03-20 15:28:36 +01:00
Bastien Nocera
41bce28447 lib: Fix warnings when D-Bus related properties change
When UPower would appear, or disappear, we'd get warnings like:
g_object_notify: object class 'UpDevice' has no property named 'g-name-owner'
or:
g_object_notify: object class 'UpClient' has no property named 'g-name-owner'

This was caused by the property proxying added in 7531dbd and 28438a7
being too lax about which properties it tried to proxy, which included
ones that didn't apply to the object types in question.

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

https://bugs.freedesktop.org/show_bug.cgi?id=102350
2018-03-02 17:47:14 +01:00
Richard Hughes
cc37137637 trivial: post release version bump 2017-11-28 11:16:37 +00:00
Richard Hughes
b443f750cf Released UPower 0.99.7 2017-11-28 11:15:54 +00:00
Bastien Nocera
7771a57b81 linux: Add test for Bluetooth LE battery support
https://bugs.freedesktop.org/show_bug.cgi?id=92370
2017-11-02 15:37:39 +01:00
Bastien Nocera
ccb1b0ed96 linux: Add support for Bluetooth LE device batteries
As exported through BlueZ's org.bluez.Battery1 D-Bus interface. This
interface is only used for device where the battery information cannot
be processed in the kernel.

This is the first UpDevice type that doesn't use UdevDevice for the
Linux backend, and it is also the first that does not poll() status at
all.

https://bugs.freedesktop.org/show_bug.cgi?id=92370
2017-11-02 15:37:39 +01:00
Bastien Nocera
b9aaa05bc6 docs: Better documentation for the BatteryLevel prop
https://bugs.freedesktop.org/show_bug.cgi?id=103361
2017-10-31 17:45:18 +01:00
Bastien Nocera
296f5855d0 main: Use g_clear_object() when possible
Rather than using != NULL, followed by unref().

https://bugs.freedesktop.org/show_bug.cgi?id=103380
2017-10-31 17:42:55 +01:00
Bastien Nocera
b3f39a5ca3 linux: Use g_clear_object() when possible
Rather than using != NULL, followed by unref().

https://bugs.freedesktop.org/show_bug.cgi?id=103380
2017-10-31 17:42:55 +01:00
Bastien Nocera
6270beb06c linux: Add example to run a single test
https://bugs.freedesktop.org/show_bug.cgi?id=103380
2017-10-31 17:42:55 +01:00
Bastien Nocera
91c7f7c0f8 linux: Remove empty API docs
Those "API documentation" don't document the function below it, they
just name it, so aren't needed.

https://bugs.freedesktop.org/show_bug.cgi?id=103380
2017-10-31 17:42:55 +01:00
Christian Kellner
cc105925b4 daemon: allow to be replaced via --replace,-r
https://bugs.freedesktop.org/show_bug.cgi?id=99906
2017-10-31 17:40:39 +01:00
Bastien Nocera
2dd321fab7 linux: Fix compilation with libimobiledevice git
Since libimobiledevice 5a8449a, LOCKDOWN_E_NOT_ENOUGH_DATA was renamed
to LOCKDOWN_E_RECEIVE_TIMEOUT. We'll use "-7" to avoid having to use
build glue.
2017-09-21 17:17:22 +02:00
Miroslav Sustek
212599f0ee daemon: Fix critical action after resume from hibernate
The take_action_timeout_cb() function returns G_SOURCE_REMOVE which
makes GLib destroy the timeout. However the action_timeout_id
stayed != 0 so when warning level turned to "action" again the daemon
assumed that the timeout is already set and did nothing.
(It only logged: "Not taking action, timeout id already set")

https://bugs.freedesktop.org/show_bug.cgi?id=87791
2017-09-21 17:10:19 +02:00
Richard Hughes
b69b262230 trivial: post release version bump 2017-09-11 16:15:13 +01:00
Richard Hughes
98d98fcbd0 Released UPower 0.99.6 2017-09-11 16:14:17 +01:00
Bastien Nocera
ef592ca52d Revert bug 99862 patchset
The patchset was pushed by mistake and is still being reviewed.
2017-09-08 18:23:32 +02:00
Jasper Lievisse Adriaanse
ad75f189d2 openbsd: Remove SENSOR_MAX_TYPES upper bound
Remove pointless upperbound, SENSOR_MAX_TYPES has no meaning here
and we break from the loop anyway when needed (i.e. when ENOENT
is returned). This aligns the code with other sensor device
walkers in OpenBSD.

https://bugs.freedesktop.org/show_bug.cgi?id=95257
2017-09-08 18:20:52 +02:00
Christian Kellner
e4b85ef5df daemon: more efficient poll resetting
If the poll timeout is actually changed because the warning level
has changed, only reset the actual poll code, not the warning level
notifications and the booking structures.

https://bugs.freedesktop.org/show_bug.cgi?id=99862
2017-09-08 18:05:19 +02:00
Christian Kellner
7171ce38d6 daemon: move two functions up
No semantic change.

https://bugs.freedesktop.org/show_bug.cgi?id=99862
2017-09-08 18:05:18 +02:00
Christian Kellner
924b42e4f8 daemon: only reset poll if warning-level changed
When a device is refreshed because the poll timeout has been reached,
the warning-level change notification can also be fired, which then
will reset (i.e. disable, re-enable) polling. For batteries this can
happen three times in a row.
Now we reset polling only if the calculated timeout actually differs
from the current one.

https://bugs.freedesktop.org/show_bug.cgi?id=99862
2017-09-08 18:04:15 +02:00
Bastien Nocera
fb9f19c3b5 linux: Add test for crash when battery has funky name
https://bugs.freedesktop.org/show_bug.cgi?id=93095
2017-09-08 17:59:42 +02:00