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

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.


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


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.