Commit graph

1318 commits

Author SHA1 Message Date
Bastien Nocera
90d4530142 lib: Split out connecting to a UPower daemon 2019-10-23 17:18:56 +02:00
Bastien Nocera
78426641df lib: Add up_device_set_proxy_sync() helper
Similar to up_device_set_object_path_sync() but allows changing the
D-Bus name and the bus type as well.
2019-10-23 17:08:25 +02:00
Bastien Nocera
f92e43ef46 lib: Add guards for functions unsupported in session mode 2019-10-23 16:53:04 +02:00
Bastien Nocera
0ad799ff98 lib: Add bus_watch_namespace() helper
From GNOME's gnome-settings-daemon/plugins/media-keys/
2019-10-23 16:53:04 +02:00
Bastien Nocera
db4634606d tools: Add --session/-s option to upower tool 2019-10-23 16:53:04 +02:00
Bastien Nocera
3e3fa04ffb lib: Add up_client_new_session()
To create a UpClient that will listen on the session bus.
2019-10-23 16:53:04 +02:00
Bastien Nocera
6a8715ce98 lib: Add "bus-type" property
A stub implementation that will eventually be used to monitor session
services for exported battery data.
2019-10-23 16:53:04 +02:00
Bastien Nocera
0598c1e0b8 lib: Remove stubs of API docs for internal functions 2019-10-23 16:53:04 +02:00
Bastien Nocera
db3575a6ba lib: Mark g_object_unref() as a function in doc
up_client_get_devices()'s API doc didn't have the parenthesis for
g_object_unref, so gtk-doc wouldn't link it to the GObject function.
2019-10-23 16:53:04 +02:00
Bastien Nocera
3769776e12 lib: Add guard to up_client_get_devices() 2019-10-23 16:53:04 +02:00
Bastien Nocera
d6cbf5c7df lib: Add guard to up_client_get_display_device()
And add linefeed in API doc.
2019-10-23 16:53:04 +02:00
Bastien Nocera
b75f0e2817 lib: Initialise ->priv as soon as possible
If properties were to be set during construction, ->priv needs to not be
a dangling/NULL pointer after the object initialization.
2019-10-23 16:53:04 +02:00
Bastien Nocera
a1a437d7b1 linux: Add test for Appearance property being missing
Similar test to the test_bluetooth_le_mouse() one, but without an
appearance property.
2019-10-23 13:32:08 +02:00
Bastien Nocera
27541a6130 linux: Remove unused code in test suite
There's no need to create a udev device, the metadata comes from bluez.
2019-10-23 13:32:08 +02:00
Bastien Nocera
ed0dfe4427 linux: Fix warning when bluez Appearance property isn't set
The Appearance property might not be available, and would cause
warnings like:
upowerd[17733]: g_variant_get_type: assertion 'value != NULL' failed
upowerd[17733]: g_variant_type_is_subtype_of: assertion 'g_variant_type_check (type)' failed
upowerd[17733]: g_variant_get_uint16: assertion 'g_variant_is_of_type (value, G_VARIANT_TYPE_UINT16)' failed
2019-10-17 16:43:15 +02:00
Bastien Nocera
8e6cb06ff6 linux: Fix memory leak in Bluez backend
g_dbus_proxy_get_cached_property() returns transfer full GVariants.
2019-10-17 16:42:22 +02:00
Martin Pitt
c742d55725 trivial: post release version bump 2019-09-03 08:51:06 +02:00
Martin Pitt
e1548bba61 Released UPower 0.99.11 2019-09-03 08:47:44 +02:00
Bastien Nocera
4b3df4d2ad Add code of conduct document 2019-07-25 12:08:15 +02:00
Hans de Goede
04ee9afb58 UpKbdBacklight: Fix endless loop burning 100% CPU on keyboard plugout
If an external keyboard with a backlight gets unplugged then
up_kbd_backlight_event_io would constantly get called, burning 100% CPU.

To make things worse, up_kbd_backlight_event_io would also constantly post
DBUS events, causing gnome-shell to also become very unresponsive.

This commit fixes this by returning FALSE from up_kbd_backlight_event_io
on unplug.

While at it also fix calling up_kbd_backlight_emit_change with a negative
brightness value in other error scenarios. Specifically this fixes
calling up_kbd_backlight_emit_change with -1 on the initial
up_kbd_backlight_event_io call in which case up_kbd_backlight_brightness_read
will typically fail with ENODATA.
2019-06-04 07:16:59 +00:00
Martin Blanchard
d15e95f785 build: Migrate from intltool to gettext
https://gitlab.freedesktop.org/upower/upower/issues/89
2019-05-18 18:38:35 +02:00
Bastien Nocera
fccc47114a linux: Use symbolic names for device types in test suite 2019-05-09 11:17:02 +02:00
Bastien Nocera
f16a8feea0 linux: Add gaming input type to the test suite
The enum member was missing.
2019-05-09 11:17:02 +02:00
Bastien Nocera
56ff72fdf4 rules: Reduce our list of HID++ devices
Those devices have been supported in the Linux kernel since at least
3.19, so there's no need to try and support those with our user-space
handling.

Closes: #3
2019-05-09 11:03:01 +02:00
Bastien Nocera
fb10b80d44 rules: Split off HID++ rules
They should probably have been split off from the start.
2019-05-07 16:56:09 +02:00
Bastien Nocera
8ead05234c linux: Add test for Logitech unknown device races
Check that external devices which show up as "battery" types have their
capacity_level correctly read, and that the device's type will be
correctly read after an input node is attached.
2019-05-07 11:44:22 +00:00
Bastien Nocera
71efbf00ca linux: Start polling for unknown device batteries too
This check is supposed to start a poll for 1) batteries embedded in
external devices 2) batteries when battery polling is not disabled.

Make sure to start the poll for all batteries embedded in devices even
the ones that are just detected as "battery".
2019-05-07 11:44:22 +00:00
Bastien Nocera
61028d84d8 linux: Retry to get a battery type if it's unknown
On some devices the power_supply node will show up before a related node
such as "input", making it impossible to know which type of device we're
attached to without waiting. Try to detect the device type again if the
device type is still "battery".

This fixes some Logitech devices appearing as "Battery" instead of their
respective device type, such as "mouse".
2019-05-07 11:44:22 +00:00
Bastien Nocera
057238a04d linux: Don't treat device batteries like laptop batteries
Use the correct refresh function for device batteries which aren't of a
known type. This fixes battery information not getting updated on many
Logitech wireless devices.

Reproducer:
- Unplug Logitech receiver
- Replug Logitech receiver
- Press button on Logitech keyboard
- Move mouse/touchpad

The touchpad battery would be stuck in "unknown" and with a "type" of
battery. This commit forces the correct refresh function to be used, one
that reads the capacity_level on those devices, and will update the
overall battery level.

Closes: #72
2019-05-07 11:44:22 +00:00
Bastien Nocera
c7104a19b3 docs: Mention that not all batteries are laptop batteries
They might be device batteries where the device type is not known or
catalogued.
2019-05-07 11:44:22 +00:00
Topi Miettinen
1c6a6bfbbb
Harden systemd service
Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
2019-04-05 13:16:45 +03:00
Martin Pitt
e06bfc6a12 Let systemd create /var/lib/upower
This directory may not exist when cleaning out /var (e. g. on stateless
systems). As upowerd cannot mkdir it by itself due to `ProtectSystem`,
let systemd create it via `StateDirectory`.

Keep `ReadWritePaths` and the `mkdir` in the Makefile to continue to
support a non-default `--historydir`.
2019-02-24 08:56:10 +01:00
Michael Biebl
18457c99b6 Move D-Bus policy file to /usr/share/dbus-1/system.d/
To better support stateless systems with an empty /etc, the old location
in /etc/dbus-1/system.d/ should only be used for local admin changes.
Package provided D-Bus policy files are supposed to be installed in
/usr/share/dbus-1/system.d/.

This is supported since dbus 1.9.18.

https://lists.freedesktop.org/archives/dbus/2015-July/016746.html
2019-02-24 08:14:43 +01:00
Christian Kellner
9b7ce3dea3 Replace use of G_TYPE_INSTANCE_GET_PRIVATE
G_TYPE_INSTANCE_GET_PRIVATE has been deprecated since glib version
2.58 and should be replaced with the xxx_get_instance_private (obj)
which is generated by G_ADD_PRIVATE.
2019-02-21 12:09:06 +01:00
Christian Kellner
8da188b303 Replace use of deprecated g_type_class_add_private
Use G_DEFINE_TYPE_WITH_CODE (..., G_PRIVATE_ADD (...)) instead of
the (deprecated since glib 2.58) function g_type_class_add_private
to add a private structure for a type.
Bump the minimal required version of glib to 2.38.0, the version
where G_PRIVATE_ADD was added.
2019-02-21 12:07:59 +01:00
Christian Kellner
2a9598372c trivial: post release version bump 2019-02-20 14:50:48 +01:00
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