Commit graph

1736 commits

Author SHA1 Message Date
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
oleid@mescharet.de
fa38e1c404 daemon: Fix crash when '@' is present in the device name
GDBus doesn't like '@' in the object path, so escape it.

https://bugs.freedesktop.org/show_bug.cgi?id=93095
2017-09-08 17:59:42 +02:00
Bastien Nocera
877a233ef6 daemon: Remove [Install] section comment
https://bugs.freedesktop.org/show_bug.cgi?id=92487
2017-09-08 17:46:55 +02:00
Bastien Nocera
362e851262 HACKING: Mention "make check" in the file
https://bugs.freedesktop.org/show_bug.cgi?id=101923
2017-09-08 17:40:18 +02:00
Bastien Nocera
8898d2b9ac linux: Add better debug to sysfs_get_capacity_level()
Remove the trailing linefeed from the sysfs attribute to be able to
print it, and simplify the loop by the same token.
2017-09-08 17:10:40 +02:00
Bastien Nocera
359008b7b7 linux: Don't throw an error if there's no data to read
The initial "refresh" for devices would fail if there was no data to
read. Instead, we should set the level to unknown, so that the device
appears in the Power panel, and in the "upower -d" output.
2017-09-08 16:53:08 +02:00
Alberto Villa
71ba27a7ea freebsd: Fix lid detection on FreeBSD
UPower sets property LidIsPresent to true only if hw.acpi.lid_switch_state
is different from "NONE", "NONE" being the default value for FreeBSD.
Thus, the property is always false on default configurations.

Force UPower not to care about the value of the sysctl, making it check
only for its existence.

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=175531

https://bugs.freedesktop.org/show_bug.cgi?id=101828
2017-09-08 15:38:25 +02:00
Bastien Nocera
4753a8bc5a lib: Fix API docs for *-level properties
One was referencing a non-existent enum member, the other was
missing a link altogether.
2017-09-08 06:55:54 +02:00
Bastien Nocera
2ef05c4220 linux: Grab model name from device if unavailable from battery
The "model_name" and "serial_number" information that upower exports for
batteries that supply a laptop or UPS are supposed to be that of the
battery. But that's very unlikely to happen for devices, such as
wireless mice, keyboards or joysticks.

Look for a sibling input device if a device battery does not contain
model information so as to avoid generic names in UIs.

https://bugs.freedesktop.org/show_bug.cgi?id=102493
2017-09-04 14:05:15 +02:00
Bastien Nocera
623a6bfc57 linux: Move function to prepare for new use
Move up_device_supply_get_sibling_with_subsystem() so we can use
it in up_device_supply_refresh_device()

https://bugs.freedesktop.org/show_bug.cgi?id=102493
2017-08-31 16:21:25 +02:00
Bastien Nocera
320cc87811 linux: Detect joysticks as gaming input devices
https://bugs.freedesktop.org/show_bug.cgi?id=102493
2017-08-31 16:21:21 +02:00
Bastien Nocera
5ccd4fe959 lib: Add UP_DEVICE_KIND_GAMING_INPUT for gaming devices
Joypads, joysticks, dance mats, paddles, Wiimotes, steering wheels,
tractor cabin simulators, pedals, yokes, breathing controllers, and,
hmm, etc.

https://bugs.freedesktop.org/show_bug.cgi?id=102493
2017-08-31 16:21:18 +02:00
Bastien Nocera
1dc2b96eec linux: Add test for wireless joypad connected via USB
Mostly for the type of device rather than the connections.

https://bugs.freedesktop.org/show_bug.cgi?id=102493
2017-08-31 16:21:14 +02:00
Benjamin Berg
502c63b549 linux: Correctly close inhibitor FD
The unref of the FD list for the inhibitor was missing which means that
the FD was leaked and the lock was never released. This means that for
each suspend/resume cycle a new inhibitor would be added.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2017-08-03 16:21:12 +01:00
Richard Hughes
02b117f5ad trivial: post release version bump 2017-07-24 13:24:17 +01:00
Richard Hughes
82779915be Released UPower 0.99.5 2017-07-24 13:23:07 +01:00
Richard Hughes
798588a480 Do not spin in a loop when /proc/timer_stats cannot be written
Only set up the polling once the write has succeeded.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100626
2017-04-23 20:23:27 +01:00
Bastien Nocera
eb6b1b62a2 lib: Simplify string checks
We don't need to protect against NULL values, we already do at the start
of the function.

Created with:
:%s,g_strcmp0\(.*\) == 0,g_str_equal \1,

Mentioned in:
https://bugs.freedesktop.org/show_bug.cgi?id=100359#c14
2017-04-10 10:37:32 +02:00
Bastien Nocera
660c8f3268 daemon: Move a number of constants to a shared file
https://bugs.freedesktop.org/show_bug.cgi?id=100359
2017-04-06 16:33:38 +02:00
Bastien Nocera
499d05b837 all: Add BatteryLevel property
Export approximate battery levels that devices can use, exported by
the kernel as POWER_SUPPLY_CAPACITY_LEVEL_* values.

This avoids bizarrely accurate values showing up in UIs when we only
have ok/warning levels of accuracy in some cases.

https://bugs.freedesktop.org/show_bug.cgi?id=100359
2017-04-06 16:33:38 +02:00
Bastien Nocera
4f9230900b lib: Add more members to UpDeviceLevel struct
Those levels will not be used to cover warning levels, but approximate
battery levels that devices can use, exported by the kernel as
POWER_SUPPLY_CAPACITY_LEVEL_* values.

See linux/power_supply.h

https://bugs.freedesktop.org/show_bug.cgi?id=100359
2017-04-06 14:18:10 +02:00
Bastien Nocera
6b14798281 linux: Add support for "capacity_level" attribute
Some devices, such as a number of wireless Logitech unifying devices
don't have a precise battery level reporting, and use the Linux
POWER_SUPPLY_CAPACITY_LEVEL_* values.

This minimal fix matches the levels against approximate percentage
values. This is good enough to make the Logitech T650 report battery
again when using the kernel HID++ battery support.

https://bugs.freedesktop.org/show_bug.cgi?id=100359
2017-04-06 14:18:10 +02:00
Bastien Nocera
27a3eea5e5 daemon: Make warning levels for devices inclusive
A 5% battery level should already be in "critical", this matches the
configurable thresholds where the bounds of critical warnings are
inclusive. This also makes it easier to create fake percentages for the
Logitech devices with coarse battery level reporting.

https://bugs.freedesktop.org/show_bug.cgi?id=100359
2017-04-06 14:18:10 +02:00
Christian Kellner
c237298297 integration-test: Fix path for unparented device
Paths supplied to testbed.add_device() are relative to /sys/devices
already and therefore must not start with /sys/devices.

This does not change the result of the test.

https://bugs.freedesktop.org/show_bug.cgi?id=100539
2017-04-06 14:16:15 +02:00
Christian Kellner
90aec997ce integration-test: enable running from JHBuild
https://bugs.freedesktop.org/show_bug.cgi?id=99763
2017-03-25 18:08:50 +01:00