summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* linux: Remove unused variableHEADmasterBastien Nocera2023-04-181-1/+0
| | | | | | ../src/linux/up-backend.c:158:19: warning: unused variable 'name' [-Wunused-variable] g_autofree char *name = NULL; ^
* battery: Fix some warningsLandry Breuil2023-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | building natively on OpenBSD with clang 13, i get those warnings: ../src/up-device-battery.c:128:53: warning: absolute value function 'abs' given an argument of type 'gint64' (aka 'long long') but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value] if (abs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - abs (td)) > abs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td)) ^ ../src/up-device-battery.c:128:53: note: use function 'llabs' instead if (abs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - abs (td)) > abs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td)) ^~~ llabs ../src/up-device-battery.c:128:65: warning: absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value] if (abs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - abs (td)) > abs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td)) ^ ../src/up-device-battery.c:128:65: note: use function 'llabs' instead if (abs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - abs (td)) > abs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td)) ^~~ llabs
* ci: Add clang to the CI imageBastien Nocera2023-04-181-0/+1
|
* linux: Guard against devices with no serialBastien Nocera2023-04-181-0/+2
| | | | | | | | | | Avoid warning if one of the devices doesn't have a serial: GLib-CRITICAL **: g_ascii_strcasecmp: assertion 's2 != NULL' failed #1 0x00007fbe1b7c0b6d in g_log (log_domain=log_domain@entry=0x7fbe1b81300e "GLib", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7fbe1b81e9dd "%s: assertion '%s' failed") at ../../../../Projects/jhbuild/glib/glib/gmessages.c:1460 #2 0x00007fbe1b7c1af9 in g_return_if_fail_warning (log_domain=log_domain@entry=0x7fbe1b81300e "GLib", pretty_function=pretty_function@entry=0x7fbe1b8238c0 <__func__.24> "g_ascii_strcasecmp", expression=expression@entry=0x7fbe1b815e0e "s2 != NULL") at ../../../../Projects/jhbuild/glib/glib/gmessages.c:2930 #3 0x00007fbe1b7dad3a in g_ascii_strcasecmp (s1=<optimized out>, s2=<optimized out>) at ../../../../Projects/jhbuild/glib/glib/gstrfuncs.c:1878 #4 0x0000000000411025 in find_duplicate_device (backend=backend@entry=0xc3dc00, device=device@entry=0xc782e0) at ../../../../Projects/jhbuild/upower/src/linux/up-backend.c:139
* linux: Add test for duplicate USB/Unifying devicesBastien Nocera2023-04-182-0/+773
|
* linux: Hide duplicate USB devicesBastien Nocera2023-04-171-19/+56
| | | | | | | | | | | | | | Make our unduplicating code a bit more clever and hide the non-BlueZ devices with the "unknown" battery state. When Logitech devices are connected through Unifying and USB, with the correct Linux patches[1], their serial numbers match, but the Unifying connection stops exporting the battery information, so hide that one from the export. Closes: #206 [1]: https://patchwork.kernel.org/project/linux-input/list/?series=726116
* device: Don't warn if the device is already registeredBastien Nocera2023-04-171-4/+7
|
* device: Export up_device_register()Bastien Nocera2023-04-172-1/+2
| | | | | It will be useful when we want to show some devices that aren't duplicated any more.
* tests: Add test for siblings overwiting good type guessesstuarthayhurst2023-04-172-0/+199
|
* linux: Don't overwrite guesses from previous siblingsstuarthayhurst2023-04-171-2/+5
| | | | | | | | | | | | If a power supply has multiple siblings, any guesses to device type from previous siblings will be overwritten by a sibling with no guess, as it defaults to keyboard, the highest priority. Instead, while guessing, use UNKNOWN, and only default to keyboard at the end. Could also be fixed by changing the keyboard's priority, but that might have side effects for otherwise working devices. Closes: #221
* ci: Update to newer umockdevBastien Nocera2023-04-161-0/+7
| | | | | So as to include this bug fix until 0.17.17 propagates to rawhide: https://github.com/martinpitt/umockdev/issues/206
* linux: Add test about headset devices detectionBastien Nocera2023-04-152-0/+349
|
* linux: Remove unused variableBastien Nocera2023-04-151-1/+0
|
* linux: Detect headset devices with kernel batteriesBastien Nocera2023-04-152-4/+37
| | | | | | | | | The code that handles battery information coming from the kernel didn't have any code to set audio type of devices. As we add support for USB wireless headsets in the kernel, add code to detect those and set the UPDevice kind to the right value. Closes: #229
* tests: Fix charging test in test_battery_state_guessingBastien Nocera2023-04-152-2/+2
| | | | | Wait longer for the state guessing to actually kick in, 25 seconds was too slow and we were getting the old state instead.
* tests: Remove assertion in test_battery_state_guessingBastien Nocera2023-04-151-1/+3
| | | | | The history clearing doesn't work, see: https://gitlab.freedesktop.org/upower/upower/-/issues/230
* battery: Fix power rate checks for amount < 1WBastien Nocera2023-04-151-1/+1
| | | | | Fix the power rate check, energy_rate is a float, and abs() handles ints, so any rate under 1W would have been truncated to 0.
* tests: Fix discharge rates in test_battery_state_guessingBastien Nocera2023-04-151-2/+4
| | | | | | | | | up_device_battery_estimate_power() expects a charge/discharge rate of 0.5W to be significant, but the existing code yielded a rate of -0.000240W. Fix the units so that the amount of change in energy_now is at least 1W/s converted to µWh.
* linux: Fix getting properties in assertDevs()Bastien Nocera2023-04-141-1/+1
| | | | | | | | | | Now that device loop is fixed, we also need to fix the D-Bus object path for the devices themselves to match what UPower generates so we can get its properties. As we iterate over the expected array, the elements are the basenames of those object paths. Reconstruct the full object paths by prepending /org/freedesktop/UPower/devices/
* linux: Fix broken assertDevs() device loopBastien Nocera2023-04-141-2/+2
| | | | | | | | | | | | | | | | | The test uses a generator to get the list of basenames for the devices: names = (n.split('/')[-1] for n in devs) Unfortunately, using that "names" varible will consume the generator, and our array will be lost. When passing a device dictionary, this code: print(sorted(names)) print(sorted(names)) will yield: ['battery_hidpp_battery_0'] [] Save the sorted array, and use that to test for properties equality.
* rules: Update hwdb from upstream NUTBastien Nocera2023-04-111-0/+1
|
* ci: Use detached pipelinesBastien Nocera2023-03-151-0/+5
| | | | See https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/438#what-it-means-for-me-a-maintainer-of-a-project-part-of-gitlabfreedesktoporg
* linux: Test fix for warning when a duplicate device appearsBastien Nocera2023-02-281-11/+11
| | | | Make the Bluetooth device appear first.
* linux: Test adding Bluetooth devices after daemon startBastien Nocera2023-02-281-2/+10
| | | | | As is usually the case in reality, as bluez must be started for Bluetooth devices to be able to connect.
* linux: Fix dbusmock addition of fake batteryBastien Nocera2023-02-281-0/+6
| | | | | We need to send the InterfacesAdded signal in case upower is already started, so it can properly keep track of the interesting bluez devices.
* linux: Fix warning when a duplicate device appearsBastien Nocera2023-02-281-3/+9
| | | | | | | | | | | When a kernel device appears after the Bluetooth device, we could be trying to bind the model property onto itself on the Bluetooth device. Avoid this possibility by always binding the property from the bluez device to the non-bluez device. GLib-GObject-WARNING **: 20:20:50.644: Unable to bind the same property on the same instance Fixes: 778b93a336bef ("linux: Hide duplicate Logitech Bluetooth devices")
* linux: Add test for Logitech HID++/Bluetooth deduplicationBastien Nocera2023-02-271-0/+90
| | | | | This tests for the device-removed g_warning(), following the Alias property on bluez devices, and the "Unhandled key" warnings.
* main: Fix warning for hidden deviceBastien Nocera2023-02-271-2/+3
| | | | | | | | | | Some Bluetooth devices can be hidden if they also export their battery info through the kernel, so make sure to not throw a warning when they go away. (upowerd:133931): UPower-WARNING **: 02:49:48.012: INTERNAL STATE CORRUPT (device-removed): not sending NULL, device:0x1f5dae0 Fixes: 778b93a336be ("linux: Hide duplicate Logitech Bluetooth devices")
* linux: Demote warning to debugBastien Nocera2023-02-271-1/+1
| | | | | | | | Fixes warnings like: (upowerd:133931): UPower-Linux-WARNING **: 02:49:48.011: Unhandled key: ServicesResolved value: false (upowerd:133931): UPower-Linux-WARNING **: 02:49:48.012: Unhandled key: Connected value: false Fixes: 29ecd92f9ce4 ("linux: Fix BlueZ device names not synchronising")
* linux: Fix device paths in testsBastien Nocera2023-02-271-8/+8
| | | | | add_device() doesn't need the full sysfs path if there's a parent, otherwise this section of the path will be duplicated.
* linux: Test for "present" sysfs attribute handlingBastien Nocera2023-02-211-0/+36
|
* linux: Fix is-present for devices at startupMario Limonciello2023-02-211-1/+5
| | | | | As will be documented in the kernel through this patch: https://patchwork.kernel.org/project/linux-pm/patch/20230220131018.1708991-1-hadess@hadess.net/
* rules: Update hwdb from upstream NUTBastien Nocera2023-02-211-0/+1
|
* ci: Fix docs getting wiped between stagesBastien Nocera2023-02-211-1/+2
| | | | Same as previous commit, but for docs.
* ci: Fix tree getting wiped between stagesBastien Nocera2023-02-201-6/+4
| | | | It's stopping us from being able to run tests.
* rules: Update hwdb from upstream NUTBastien Nocera2022-11-161-0/+1
|
* idevice: Simplify setting the modelBastien Nocera2022-11-161-1/+1
|
* idevice: Prefer the user-chosen name when availableKai Uwe Broulik2022-11-161-0/+10
| | | | | Use the device name as model name when the user-chosen device name is available. This matches what the Bluez backend does.
* ci: Fix paths included in build artifactsBenjamin Berg2022-11-031-1/+2
| | | | | Seems like using $(pwd) got broken with newer gitlab versions. Just use the CI_PROJECT_DIR (though we could also just use '.' even).
* enumerator-udev: also check for an idevice on "usb" subsystemMaciej S. Szmigiero2022-10-292-2/+23
| | | | | | | | | | | | Commit 1550d50f ("linux: Remove "usb" subsystem match") broke detection of some idevices, since it left just the "usbmisc" subsystem match while some idevice / kernel combinations (at least an iPhone 11 on a 6.0 kernel) don't present any such udev usbmisc devices. However, they do present "usb" subsystem ones, so add this match back. Leave idevice detection also for the "usbmisc" match since that's what the original (known working) code before aforementioned commit did - it is possible that it is required for some kernel / idevice combinations.
* enumerator-udev: actually check for an ideviceMaciej S. Szmigiero2022-10-211-0/+5
| | | | | | | | | | | up-enumerator-udev.c forgot to include the build config file, resulting in HAVE_IDEVICE macro always being undefined. This meant that the idevice backend was never actually instantiated - as evidenced by the file not even compiling when this was fixed, due to missing "up-device-idevice.h" include. Fix both of these issues.
* supply-battery: Assume battery is present if the attr is missingBenjamin Berg2022-09-091-1/+3
| | | | Fixes: #208
* linux: Test whether BT mice get de-duplicatedBastien Nocera2022-09-051-0/+15
|
* linux: Make BT mouse export its serial numberBastien Nocera2022-09-051-1/+2
| | | | As a real mouse would.
* linux: Make BT mice use the same address in testsBastien Nocera2022-09-051-5/+5
| | | | So we can use, one, the other, or both, and still see a single device.
* linux: Hide duplicate Logitech Bluetooth devicesBastien Nocera2022-09-051-0/+57
| | | | | | | | | | | | A lot of newer Logitech devices support both the BATT Bluetooth LE service as well the HID++ protocol. This advertises 2 separate battery interfaces, one HID++ one through the kernel, one BATT one through BlueZ. Avoid confusing UIs and hide the Bluetooth battery from the interface by checking for duplicates each time a new device is added. Closes: #166
* daemon: Don't count hidden devicesBastien Nocera2022-09-051-1/+2
|
* daemon: Don't warn if a device gets unexportedBastien Nocera2022-09-051-4/+4
| | | | | Now that we can unregister devices from the bus, make sure that we don't throw warnings doing that.
* daemon: Don't add unexported devices to the arrayBastien Nocera2022-09-051-1/+4
| | | | Otherwise all the following devices will be ignored.
* device: Make it possible to remove devices from D-BusBastien Nocera2022-09-052-2/+15
| | | | | | | | | Add up_device_unregister() method to allow backends to hide particular UpDevices from the D-Bus interface. Also rename the private up_device_register_device() function, no need to say "device" twice there, we're registering the only device passed as an argument.