`powertop --auto-tune` without messing with USB and touchpad

8,299

Solution 1

Try running "sudo powertop" and tab over to the "Tunables" selection, there it should show you a list of everything that powertop is able to tune. Somewhere on that list will show your something like, "Autosuspend for USB device...,"

One of the USB devices listed should be the one you are having trouble with; try leaving it's settings as "Bad" as that is the unmodified state.

Check out the powertop users guide for additional info and tips: https://01.org/sites/default/files/page/powertop_users_guide_201406.pdf

Solution 2

If you run powertop --auto-tune manually you could create a script like:

cat - > powertune.sh <<EOF
#!/bin/bash
powertop --auto-tune
HIDDEVICES=$(ls /sys/bus/usb/drivers/usbhid | grep -oE '^[0-9]+-[0-9\.]+' | sort -u)
for i in $HIDDEVICES; do
  echo -n "Enabling " | cat - /sys/bus/usb/devices/$i/product
  echo 'on' > /sys/bus/usb/devices/$i/power/control
done
EOF

The script will run powertop and then look at all the USB devices using the Human Interface Device driver and subsequently disable power management for them. So it should be resistant to plugging mice/keyboard in different ports.

You could also combine it with a systemd service to run it automatically at bootup.

Solution 3

Check out my little project to create a shell script to automatically apply powertop's "good" power settings.

You can then easily edit the resulting script to comment out any configuration that's giving you trouble and run it instead of sudo powertop --auto-tune.

Share:
8,299

Related videos on Youtube

UTF-8
Author by

UTF-8

Updated on September 18, 2022

Comments

  • UTF-8
    UTF-8 over 1 year

    I like powertop --auto-tune because the speakers of my laptop are soughing when not being used and powertop disables the speakers completely when they're not used, stopping the noise.

    However, my USB mouse gets disabled within seconds after not using it and after a few more seconds, my touchpad has a delayed response (works fine after the first delay of a fraction of a second, though).

    How do I make this stop but still disable my speakers completely when no audio is put out?

  • UTF-8
    UTF-8 over 8 years
    Thank you! Is there a command disabling power saving for this specific device? Doing this every time I restart my laptop is inconvenient. If this isn't possible: Is there a command to enable power saving only for one specific device? I don't really need powertop --auto-tune but instead only care that a single device is on power save mode (and that my mouse isn't).
  • UTF-8
    UTF-8 over 8 years
    Thank you! Thanks to you I found out that powertop shows what line it's running to set a certain power setting right when this is done manually. This solved my problem. :)
  • David Foerster
    David Foerster over 8 years
    Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.)
  • Ivan Aksamentov - Drop
    Ivan Aksamentov - Drop about 6 years
    Excellent, thank you. The only thing is that cat here would not produce the expected result, because it will substitute the values of HID devices that are currently in use, hardcoding them. To preserve the dynamic device selection, just copy-paste the contents of the heredoc (the part between EOF) into a file manually.
  • WhyNotHugo
    WhyNotHugo about 4 years
    This is great (although I copied the script, rather than use cat EOF. I think it's best to simplify the answer in that sense. The logic is solid though, finally no more issues with powertop! :)