Skip to content

Auto power profile switching broken on USB-C only machines on v3.6.0 #5412

@jcontonio

Description

@jcontonio

System details

Thinkpad P14S Gen 6 Intel - Arrow Lake Ultra 7 255H

What's wrong?

The udev rule in install/config/powerprofilesctl-rules.sh matches on ATTR{type}=="Mains", which assumes the AC power supply device fires udev change events on plug/unplug. On ThinkPads and likely other USB-C only machines, the AC device never fires these events, only the ucsi-source-psy-* devices do.

Additionally, power-profiles-daemon is left in a disabled state after the update, which prevents profile switching entirely even if the udev rule matched.

Steps to reproduce

  1. Install or update to v3.6.0 on a USB-C only machine (e.g. Thinkpad)
  2. Plug or unplug the charger
  3. Power profile does not switch

Diagnosis

The AC device exists and reports correctly:

$ cat /sys/class/power_supply/AC/type
Mains
$ cat /sys/class/power_supply/AC/online
1

But it never fires a udev change event. Only the USB-C port devices fire events:

$ udevadm monitor --property | grep -A5 "power_supply"
# Only ucsi-source-psy-USBC000:* events appear on plug/unplug
# /sys/class/power_supply/AC never appears

The ucsi devices have POWER_SUPPLY_TYPE=USB, not Mains, so the existing rule never matches.

Also, after the update:

$ systemctl status power-profiles-daemon
... disabled ...

Fix

In install/config/powerprofilesctl-rules.sh, we could add rules for USB type devices alongside the existing Mains rules, but I'm not positive if this is the best route.

# Existing Mains rules...
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="..."
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", RUN+="..."

# Add USB-C support for machines where AC device doesn't fire events
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_TYPE}=="USB", ATTR{online}=="0", RUN+="..."
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_TYPE}=="USB", ATTR{online}=="1", RUN+="..."

Also ensure power-profiles-daemon is enabled during install/update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions