summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Harden systemd serviceTopi Miettinen2019-04-051-0/+17
| | | | Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
* Let systemd create /var/lib/upowerMartin Pitt2019-02-241-0/+1
| | | | | | | | | 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`.
* Move D-Bus policy file to /usr/share/dbus-1/system.d/Michael Biebl2019-02-241-1/+1
| | | | | | | | | | | 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
* Replace use of G_TYPE_INSTANCE_GET_PRIVATEChristian Kellner2019-02-2120-51/+21
| | | | | | 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.
* Replace use of deprecated g_type_class_add_privateChristian Kellner2019-02-2119-52/+19
| | | | | | | | 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.
* integration-test: Test mapping pending-charge to fully-chargedJoão Paulo Rechi Vita2018-12-181-0/+25
|
* linux: Map pending-charge to fully-charged when charge is 100%João Paulo Rechi Vita2018-12-181-0/+6
| | | | | | | | 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.
* linux: Don't set out_state before state is finalJoão Paulo Rechi Vita2018-12-181-1/+2
| | | | | | | | 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.
* integration-test: Test DisplayDevice pending-chargeJoão Paulo Rechi Vita2018-11-141-0/+72
| | | | | | | 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.
* integration-test: Define PENDING_CHARGE and PENDING_DISCHARGE statesJoão Paulo Rechi Vita2018-11-141-1/+3
| | | | | Add definitions for UP_DEVICE_STATE_PENDING_CHARGE and UP_DEVICE_STATE_PENDING_DISCHARGE.
* daemon: Consider pending-charge when calculating the display stateJoão Paulo Rechi Vita2018-11-141-1/+5
| | | | | | | | | | | | | | 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
* daemon: Make comment more succinctJoão Paulo Rechi Vita2018-11-141-3/+3
| | | | | | | 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.
* src/linux/up-device-hid.c: usage_code is defined as an unsigned integerLaurent Bigonville2018-10-251-1/+1
| | | | Also define "value" as a signed 32 bits integer
* daemon: Fix upower's keyboard backlight supportwip/hadess/sandboxing-fixBastien Nocera2018-10-021-1/+2
| | | | | | | Disabling kernel tunables blocked us from accessing /sys, meaning we couldn't change keyboard backlight levels. Closes: #73
* test: Fix up-self-test crash during out-of-tree buildsBastien Nocera2018-10-022-5/+2
| | | | | | When the layout of the build tree doesn't match the expectations in up-self-test, the test would crash failing to find UPower.conf. Pass the path as a macro during build so we always know where it is.
* daemon: Fix upower not having access to udev eventsBastien Nocera2018-10-021-1/+2
| | | | | | | | | PrivateNetwork=true will cut off upower from the udev netlink socket, so it's not what we want to use, as we want those events. See https://lists.freedesktop.org/archives/systemd-devel/2018-July/041000.html Closes: #68
* linux: Add test for MacBook uevent behaviourBastien Nocera2018-06-191-0/+34
| | | | See https://gitlab.freedesktop.org/upower/upower/issues/56
* linux: Refresh for 5 seconds after plug/unplug on MacBooksBastien Nocera2018-06-191-2/+3
| | | | | | | | | 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
* linux: Detect hardware that needs more polling after eventBastien Nocera2018-06-193-0/+55
| | | | | | | | 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.
* linux: Make sure unknown poll lasts 5 secondsBastien Nocera2018-06-191-8/+14
| | | | | Rather than 5 calls to up_device_supply_setup_unknown_poll(), which can happen pretty quickly together after receiving a uevent.
* linux: Fix possible double-close on exitBastien Nocera2018-06-191-2/+3
| | | | | | | | | 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
* linux: Clean up after running test suite in "distcheck"Bastien Nocera2018-06-181-0/+6
| | | | | | 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"
* linux: Remove extra linefeedBastien Nocera2018-06-181-1/+0
|
* linux: Better error reporting from sysfs_get_double_with_error()Bastien Nocera2018-06-183-10/+19
| | | | | | 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.
* linux: Add a test for Logitech HID++ charging statesBastien Nocera2018-04-191-0/+18
| | | | | | | | 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
* daemon: Add battery-level specific iconsBastien Nocera2018-04-191-11/+35
| | | | | | | 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
* linux: Add support for "Unknown" capacity levelBastien Nocera2018-04-191-1/+2
| | | | | | | | | | 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
* linux: Add a README with a couple of debugging commandsBastien Nocera2018-04-181-0/+8
|
* daemon: Lock down systemd service fileBastien Nocera2018-04-162-1/+24
| | | | | | | Use systemd's service file to lockdown the UPower daemon to stop eventual security problems. https://bugs.freedesktop.org/show_bug.cgi?id=102898
* linux: lower severity of "unhandled action" messagesDmitry Torokhov2018-04-121-1/+1
| | | | | | | | 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
* linux: Fix memory leak if logind returns an errorBastien Nocera2018-04-121-0/+1
|
* linux: Fix crash if logind doesn't return an errorBastien Nocera2018-04-121-1/+2
| | | | For example, when using an incomplete mock logind.
* linux: Check "HasBattery" key for newer iOS versionsMartin Szulecki2018-03-201-1/+10
| | | | | | | | | 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
* linux: Prevent crash after attaching an Apple TVMartin Szulecki2018-03-201-0/+4
| | | | | | | | 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
* linux: Add test for Bluetooth LE battery supportBastien Nocera2017-11-021-0/+70
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=92370
* linux: Add support for Bluetooth LE device batteriesBastien Nocera2017-11-025-4/+462
| | | | | | | | | | | | 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
* main: Use g_clear_object() when possibleBastien Nocera2017-10-311-8/+3
| | | | | | Rather than using != NULL, followed by unref(). https://bugs.freedesktop.org/show_bug.cgi?id=103380
* linux: Use g_clear_object() when possibleBastien Nocera2017-10-313-44/+19
| | | | | | Rather than using != NULL, followed by unref(). https://bugs.freedesktop.org/show_bug.cgi?id=103380
* linux: Add example to run a single testBastien Nocera2017-10-311-1/+3
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=103380
* linux: Remove empty API docsBastien Nocera2017-10-311-25/+0
| | | | | | | 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
* daemon: allow to be replaced via --replace,-rChristian Kellner2017-10-311-1/+8
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=99906
* linux: Fix compilation with libimobiledevice gitBastien Nocera2017-09-211-2/+4
| | | | | | 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.
* daemon: Fix critical action after resume from hibernateMiroslav Sustek2017-09-212-1/+65
| | | | | | | | | | 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
* Revert bug 99862 patchsetBastien Nocera2017-09-081-42/+32
| | | | The patchset was pushed by mistake and is still being reviewed.
* openbsd: Remove SENSOR_MAX_TYPES upper boundJasper Lievisse Adriaanse2017-09-081-1/+1
| | | | | | | | | 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
* daemon: more efficient poll resettingChristian Kellner2017-09-081-2/+2
| | | | | | | | 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
* daemon: move two functions upChristian Kellner2017-09-081-32/+27
| | | | | | No semantic change. https://bugs.freedesktop.org/show_bug.cgi?id=99862
* daemon: only reset poll if warning-level changedChristian Kellner2017-09-081-2/+17
| | | | | | | | | | | 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
* linux: Add test for crash when battery has funky nameBastien Nocera2017-09-081-0/+16
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=93095
* daemon: Fix crash when '@' is present in the device nameoleid@mescharet.de2017-09-081-0/+2
| | | | | | GDBus doesn't like '@' in the object path, so escape it. https://bugs.freedesktop.org/show_bug.cgi?id=93095