Find a file
Manuel A. Fernandez Montecelo 46bbc8a602 Add support for conf.d style dirs (UPower.conf.d)
This change adds the feature to read config from conf.d style
directories (UPower.conf.d), commonly supported by other tools, as an
extension of the main config file.

This is useful and convenient in several situations, for example:

- distributions can set different values from the defaults shipped
  upstream without having to modify the main UPower.conf

- different packages or config-management tools can change config just
  by adding, removing or modifying files in that directory

The main config file, e.g. '/etc/UPower/UPower.conf', will be
processed first, and then files in the UPower.conf.d dir, if existing.

The directory to use is derived automatically, e.g.
'/etc/UPower/UPower.conf.d/' if the main config file is
'/etc/UPower/UPower.conf'.  Only files within that directory are
considered, and only those with valid config-group 'UPower' and with
the filename format: starting with '00-' to '99-', ending in '.conf'
and with alphanumeric characters, dash or underscore in between.

The candidate files within the given directory are sorted (with
g_strcmp0(), so the ordering will be as with strcmp()).  The
configuration in the files being processed later will override
previous config, in particular the main config, but also the one from
previous files processed, if the Group and Key coincide.

Add also relevant integration test: 'test_conf_d_support'
2025-11-12 15:45:56 +08:00
.ci Reformat python code style with black 2025-01-08 14:01:34 +08:00
contrib contrib: setup: Install and setup pre-commit 2025-01-13 08:55:18 +00:00
data/zsh-completion upower: Add a -b/--battery option to dump only battery information 2025-08-26 13:29:52 +08:00
dbus dbus: org.freedesktop.UPower: Enumerate kbd backlight LEDs 2025-09-05 17:22:08 +08:00
doc upower: Add a -b/--battery option to dump only battery information 2025-08-26 13:29:52 +08:00
etc etc/UPower.conf: fix "riscky" typo 2025-01-13 13:30:11 +08:00
libupower-glib lib: up-device: Expose CapacityLevel, VoltageMinDesign, and VoltageMaxDesign 2025-04-16 15:08:39 +08:00
po Update LINGUAS 2025-01-17 02:11:22 +00:00
policy polkit: fix config syntax 2025-10-21 16:59:38 +08:00
rules rules: 95-upower-hid: update hwdb from upstream NUT 2025-09-16 15:51:36 +08:00
src Add support for conf.d style dirs (UPower.conf.d) 2025-11-12 15:45:56 +08:00
tools upower: Add a -b/--battery option to dump only battery information 2025-08-26 13:29:52 +08:00
.git-blame-ignore-revs Ignore commits for tree wide changes 2025-01-08 16:54:58 +08:00
.gitconfig Ignore commits for tree wide changes 2025-01-08 16:54:58 +08:00
.gitlab-ci.yml ci: fix pre-commit test 2025-10-21 16:51:40 +08:00
.markdownlint.json ci: markdownlint: Add markdownlint to the pre-commit check 2025-01-08 13:59:50 +08:00
.pre-commit-config.yaml pre-commit-config: Remove deprecated default_stages "commit" 2025-01-13 08:55:18 +00:00
AUTHORS trivial: add my copyright 2008-09-06 11:12:24 +01:00
code-of-conduct.md Add code of conduct document 2019-07-25 12:08:15 +02:00
COMMITMENT Add COMMITMENT file as part of GPL Common Cure Rights Commitment 2018-06-18 16:11:43 +01:00
COPYING trivial: Rename a few 'DeviceKit-power' strings we missed 2010-05-28 15:00:07 +01:00
HACKING.md Ignore commits for tree wide changes 2025-01-08 16:54:58 +08:00
meson.build Add support for conf.d style dirs (UPower.conf.d) 2025-11-12 15:45:56 +08:00
meson_options.txt meson_options: replace deprecated boolean variable 2025-09-17 12:27:42 +08:00
NEWS Release 1.90.10 2025-08-26 16:04:24 +08:00
README.md README: Rename to README.md and fix markdown with markdownlint 2025-01-08 14:25:55 +08:00
RELEASE RELEASE: Update notes on how to do releases 2022-02-09 17:53:54 +01:00

UPower

Requirements:

  glib-2.0             >= 2.66.0
  gio-2.0              >= 2.16.1
  gudev-1.0            >= 235    (Linux)
  libimobiledevice-1.0 >= 0.9.7  (optional)
  polkit-gobject-1     >= 124

UPower is an abstraction for enumerating power devices, listening to device events and querying history and statistics. Any application or service on the system can access the org.freedesktop.UPower service via the system message bus.

Debugging

When doing bug reports, the following information can be useful:

  • grep . /sys/class/power_supply/*/*
    This includes the current kernel view of all power supplies in the system. It is always a good idea to include this information.
  • udevadm info -e
    This shows the hardware configuration and is relevant when e.g. the type of an external device is misdetected.
  • upower -d
    Shows upower's view of the state
  • upower --monitor-detail
    Dumps device information every time that a change happens. This helps with debugging dynamic issues.
  • udevadm monitor
    Dumps the udev/kernel reported hardware changes (and addition/removal). This is helpful when debugging dynamic issues, in particular if it is not clear whether the issue is coming from the kernel or upower.

In addition, it can also be useful to run upower in debug mode and post the logs. There are two ways of doing so:

  • Run upower daemon manually, you can do so using: sudo /usr/libexec/upowerd -rd
  • Modify the systemd service and restart. This is best done by:
    1. sudo systemctl edit upower.service

    2. Adding the two lines:

      [Service]
      Environment=G_MESSAGES_DEBUG=all
      
    3. sudo systemctl restart upower.service

    4. Grab logs using journalctl -u upower.service or similar