How do I autosuspend a usb device?

7,572

You'll need to echo '1' into each of a number of sys files as root.

You can do so like this:

for i in /sys/bus/usb/devices/*/power/autosuspend; do
  echo 1 | sudo tee $i
done

The number '1' means 'auto suspend after '1' second. You might use '2' here, if that's the behavior you want.

Alternatively, you can install and run the powernap utility, which installs a script at /etc/pm/power.d/usb_autosuspend that handles this for you automatically.

Share:
7,572
InuYaksa
Author by

InuYaksa

Updated on September 18, 2022

Comments

  • InuYaksa
    InuYaksa 3 months

    I am trying to follow the instructions on Lesswatts, to enable usb autosuspend.
    When I run powertop, it says, that I have a device (USB device 2-6 : 2.4G Multimedia Wireless Kit (Chicony)) that is running 100% of the time.

    I don't use the wifi and indeed I've blacklisted the wifi driver, so I am pretty confident I don't need this device. So I set the idle timeout to 2 seconds and

    echo auto > /sys/bus/usb/devices/2-6/power/level

    works, but the device is still active. If I try

    echo suspend > /sys/bus/usb/devices/2-6/power/level

    then the bash prompt skips ten lines and stops, but the contents of the file is still auto

    • elmicha
      elmicha over 11 years
      The information on Lesswatts is a bit outdated: dmesg says "power/level is deprecated; use power/control instead" and we can't write "suspend" anymore, only "on" or "auto" (see kernel.org/doc/Documentation/usb/power-management.txt). I'm also searching for an answer to your question, because my USB ports are still powered when the PC is off, and I want to turn them off.
    • Marius Gedminas
      Marius Gedminas almost 11 years
      A "Multimedia Wireless Kit" doesn't have anything to do with wifi -- it sounds more like some kind of a remote control, or a mini wireless keyboard.
    • William
      William almost 11 years
      @daithib8 Did Dustin's answer solve your problem? Can you mark as answer if so to let me know I should award the bounty? Thanks.
    • InuYaksa
      InuYaksa over 10 years
      @Marius you are right. it was a keyboard and Power top does recommends auto suspend for non-input devices. doh
  • joar
    joar over 10 years
    Do you know anything about which values mean what? I seem to have 2 in all my "files"
  • Madhusudhan
    Madhusudhan over 10 years
    1 means device suspend within 1 sec, 2 means suspend after 2 secs, etc. -1 means that your device will not suspend.