4

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?

7

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

| improve this answer | |
  • 1
    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 Dec 15 '15 at 19:45
  • 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. :) – UTF-8 Dec 18 '15 at 3:14
8

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.

| improve this answer | |
  • 1
    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. – Ivan Aksamentov - Drop Apr 30 '18 at 17:34
  • 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! :) – WhyNotHugo Apr 13 at 12:23
2

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.

| improve this answer | |
  • 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.) – David Foerster Feb 2 '16 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.