Commit graph

1736 commits

Author SHA1 Message Date
Benjamin Berg
4b96535023 up-client: Document and handle NULL return when getting devices 2021-02-04 09:45:50 +00:00
Marijn Suijten
8e5b1d6b46 tests: Add test cases for Bluetooth device classes 2021-02-02 18:23:19 +01:00
Marijn Suijten
15329e840c tests: Move BlueZ battery setup into helper function 2021-02-02 18:22:42 +01:00
Marijn Suijten
62d7c08289 tests: Convert unpacked tuple constants to range() 2021-02-02 18:22:42 +01:00
Marijn Suijten
98cf71fbcc linux: Parse kind from Class if Appearance is not available
Not all headsets have a GAP profile revealing their appearance, but they
do have a class.
2021-02-02 18:22:41 +01:00
Marijn Suijten
e294444496 lib: Add more device kinds for Bluetooth classes
This adds a variety of missing device kinds specific to the Bluetooth
classes supported in gnome-bluetooth [1].

In up_device_to_text these types have only been added to the
`percentage` class, which is currently the only property exposed by
org.bluez.Battery1, where these devices are coming from.

[1]: cf4a0ba59d/lib/bluetooth-utils.c (L165)
2021-02-02 18:22:25 +01:00
Marijn Suijten
d86c637f31 lib: Invert percentage conditional in device_to_text
Almost every device kind except line power and invalid (>= last) carry a
valid percentage property. By inverting this conditional not every new
device needs to be added explicitly to this already long and lacking
chain (PDA and MONITOR were already missing).
2021-02-02 18:15:47 +01:00
Bastien Nocera
64582256a8 build: Remove libusb dependency in Linux
As the last user, the CSR support code, was removed.
2021-01-19 13:31:25 +01:00
Bastien Nocera
4227d0c439 linux: Remove support for CSR devices
Those devices date back from the mid-2000s. If they still work, and
somebody is still interested in having them export their battery status,
we would recommend moving this information to the appropriate kernel
drivers.
2021-01-19 13:29:23 +01:00
Bastien Nocera
dde6f714ea linux: Set update-time for BlueZ devices
When the battery percentage for a BlueZ device changes, change the
update-time so that the charge history is somewhat useful.
2021-01-18 22:11:32 +01:00
Bastien Nocera
67eefa17dd lib: Add "Touchpad" device type 2020-12-16 13:09:04 +01:00
Bastien Nocera
c6d2618e95 linux: Fix gudev includes for UpInput 2020-11-05 16:40:36 +01:00
Bastien Nocera
d697b39408 linux: Add support for running under umockdev
The sysfs path needs to be adjusted when running under umockdev.
2020-11-05 16:22:28 +01:00
Bastien Nocera
522fb6fff2 linux: Don't throw debug errors unless needed
It's really confusing seeing "not a switch [...]" when we actually
managed to find a switch, so throw 2 errors in the debug when both
checks fail, rather than as things are being tested.
2020-11-05 16:13:43 +01:00
Bastien Nocera
47481f3a57 linux: Fix warning when compiling with meson
src/up-input.c:294:3: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
  294 |   close (input->eventfp);
      |   ^~~~~
      |   pclose
2020-10-23 14:34:34 +02:00
Bastien Nocera
4a3cc71aa6 linux: Remove unneeded header from up-input.h
Missed in an earlier commit.

Fixes: 7ddb75166d ("linux: Remove UpDaemon dependency from UpInput")
2020-10-23 14:33:27 +02:00
Bastien Nocera
809d69e66e linux: Remove unused headers in up-input.c 2020-10-22 16:53:45 +02:00
Bastien Nocera
7ddb75166d linux: Remove UpDaemon dependency from UpInput
Emit signals from UpInput for UpBackend to consume, rather than having
UpInput poke the daemon directly.
2020-10-22 16:52:37 +02:00
Bastien Nocera
50c48e0bcb linux: Make watched switch a property of UpInput
And add up_input_new_for_switch() to watch other switches.
2020-10-22 16:51:28 +02:00
Bastien Nocera
e87cc7b47c linux: Remove duplicate header in up-input.c 2020-10-22 16:50:04 +02:00
Bastien Nocera
c987ca4ed2 linux: Simplify UpInput object code
Use G_DECLARE_FINAL_TYPE() to clean up header and remove the use of a
private struct, as the whole object struct is now private.
2020-10-22 16:50:02 +02:00
Bastien Nocera
ba153833fa linux: Clarify UpInput device handling
Despite what the comments say, the device is indeed a valid input
device, it's just not one we want to add to the power devices,
as done in up-daemon.c's up_daemon_device_added_cb().
2020-10-22 14:09:08 +02:00
Bastien Nocera
6ff9ee702e linux: Fix umockdev link in test 2020-06-18 16:13:18 +02:00
Bastien Nocera
0c6fa202ea ci: Force building with libplist 2020-06-17 12:10:23 +02:00
Bastien Nocera
694207d3f0 build: Use a newer libplist if available 2020-06-17 12:10:23 +02:00
Bastien Nocera
97185bae75 linux: Add support for iPhone XR, XS models
Modifying the udev serial to be acceptable as an hyphened UDID, as the
usbmux stack expects.

Closes: #114
2020-06-17 11:01:30 +02:00
Bastien Nocera
d2917c0c71 tests: Add a keyboard/mouse combo device test 2020-05-05 16:11:45 +02:00
Bastien Nocera
e0b8354e9c linux: Identify keyboard/pointing device combos as keyboards
Rather than using the type of the first sibling device we find, which is
usually the pointing device portion, make sure that keyboard/pointing
device combo devices are identified as keyboards.
2020-05-05 16:11:42 +02:00
Bastien Nocera
85cd95ae53 linux: Detect Bluetooth pens
Numbers from:
https://www.bluetooth.com/specifications/assigned-numbers/baseband/
2019-10-24 12:52:53 +02:00
Bastien Nocera
72b85b8c13 lib: Add "Pen" device type
So we can track the battery information for powered tablet pens, rather
than labelling them as tablets.
2019-10-24 12:50:26 +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