[RESPONDED] Udev rule for power_supply (AMD)

Hi,
the following udev rules are triggered when I charge my phone via the laptop:

SUBSYSTEM=="power_supply",ATTR{online}=="0",RUN+="/usr/bin/powerprofilesctl set power-saver"
SUBSYSTEM=="power_supply",ATTR{online}=="1",RUN+="/usr/bin/powerprofilesctl set performance"

What do I have to do different that the rules are only triggered when a power supply is plugged in?

FYI those rules are probably too aggressive, especially once PPD 0.21 is released.

It’s probably better experience to change manually in situations that you need the extra performance or extra battery and leave in balanced most of the time.

3 Likes

Interesting udev rules, to set powerprofiles, isn’t there a usb id change? when phone is plugged in? maybe that can be used?

1 Like

PPD 0.21 was released today. It will specifically turn down the EPP while in balanced on battery and up on balanced on AC.

If you have specific tasks that you’re doing that you really want power savings or performance every time you should try using $ powerprofilesctl launch FOO -BAR --profile BAZ --reason BECAUSE.

This will let you change the daemon momentarily to that profile and when the process ends it will return back to standard.

1 Like

Thanks, so you recommend just disabling the udev rules as long as the profile is set to balanced?

❯ powerprofilesctl version
client: 0.21
daemon: 0.20

@Loell_Framework The rules were copied from my old laptop. I just want them to be triggered when I plug in a charger and not the phone (or any other USB device that can be charged) which is currently the case.

Yeah I don’t feel you should be using those rules for an AMD laptop.

1 Like

I’m using the udev rules still for other things to toggle. Any idea what the rule is missing to not toggle when for example a phone is plugged in?

I’m not sure.