fenrus75 / powertop

The Linux PowerTOP tool -- please post patches to the mailing list instead of using github pull requests
http://www.01.org/powertop
GNU General Public License v2.0
1k stars 130 forks source link

Powertop should allow for "sticky" tunables across reboots #37

Open WolfpackN64 opened 4 years ago

WolfpackN64 commented 4 years ago

I run Powertop with autotune on my Thinkpad T440, running Fedora 31 XFCE. As I basically want all turntables to be set on "Good". However, my USB mouse connected to my laptop freezes sporadically when it's turntable is set to "Good", so the USB autosuspend for my USB mouse is the is the only turntable I turn to "Bad". However, the turntable changes don't survive reboot, and no forum or post anywhere has a good, universal solution to this problem.

It would be far easier for end-users if Powertop could permanently write the turntable chances to the system so that your turntables survive rebooting, and it would make enabling and disabling the turntables for all kind of settings much easier.

Making complicated custom scripts for each mouse I'm going to use on my laptop, which might not work on different distros really is a bit much.

pflanzenandi commented 4 years ago

I suppose that many users of Powertop wish for exactly these features:

  1. tunables set on startup
  2. exclude unwanted tunables like usb devices

Right now I am using sysctl and change the usb device to bad manually on startup:

[Unit]
Description=Powertop tunings

[Service]
Type=exec
ExecStart=/usr/sbin/powertop --auto-tune
RemainAfterExit=true

[Install]
WantedBy=multi-user.target
thomaseizinger commented 4 years ago

The following works well for me as a workaround:

[Unit]
Description=Override tunables
After=powertop.service

[Service]
Type=oneshot
ExecStart=/usr/bin/bash -c 'echo on > /sys/bus/usb/devices/3-2.3/power/control'
ExecStart=/usr/bin/bash -c 'echo on > /sys/bus/usb/devices/3-2.4/power/control'

[Install]
WantedBy=multi-user.target

Several things to be noted here which weren't obvious to me as a not-so-experienced systemd user :)

  1. Multiple ExecStart only work with type oneshot
  2. ExecStart doesn't use a shell, i.e. you can directly redirect from there to the file, need to invoke bash for that.
  3. My powertop service doesn't have RemainAfterExit=true. I haven't tried if it makes a difference but from the documentation, I assume dependent services (like the one I posted above) might not run because the service never stops from systemd's perspective?
hellow554 commented 3 years ago

hey @fenrus75 Is there a plan on implementing this without workarounds?