How to avoid powering down certain USB devices when a machine is suspended

22,776

Solution 1

Enabling wake up on a bus does not equate with giving that bus full power while in suspend. It just means that the system will listen for the wakeup signal on the lines that correspond to that device. Standby power is provided by the appropriate bus, but this power is much less than the full power for normal operation. Adding a PCI/PCIe USB card may or may not allow for wake-on-USB, but it definitely won't provide full power to the USB ports while the machine is in S3. Instead, it will provide just enough to keep the chipset running, about 200mA @ 3.3V from what I gather from this page from Intel about its network adapters.

I think this is a feature that going to be specific to a motherboard and only controllable through the BIOS. I have a Thinkpad and a Gigabyte motherboard that allow for powering USB devices while the machine is not awake, and in both cases it's a setting in the BIOS rather than something you can change while the system is fully booted. Come to think of it, there might be a way for the Thinkpad to configure that while running, but Thinkpads are known for having special ACPI extensions for managing power options. Regardless, for both systems it's an all-or-nothing proposition - there's no option for per-port or per-device configuration. I'm fairly certain full power USB in suspend is something that is not standard across PCs, and as such, there's no portable way to check if it's available.

Although it's extra hardware, I think the simplest, most universal solution is to just use a powered hub.

Solution 2

The kernel has support for USB 2.0 power saving feature

To disable it after you have booted, you can try

echo 1 > /sys/bus/usb/devices/your-USB-device/power/autosuspend

echo "on" > /sys/bus/usb/devices/your-USB-device/power/level

For more details look in this lesswatts.org page

Share:
22,776

Related videos on Youtube

msaif
Author by

msaif

// shenanigans

Updated on September 17, 2022

Comments

  • msaif
    msaif over 1 year

    I'd like to maintain power supply to a USB-powered drive when the system goes into suspend (AKA S3 or "suspend-to-RAM") mode.

    Normally the power is cut while the machine is suspended, which causes it to be dismounted and then remounted when the system is resumed. This is not really great, especially if the drive itself supports power management.

    Although I could run it on a separate power supply, I'd prefer to have to avoid allocating more wiring for something that can, at least in theory, be done with my existing hardware.

    How can I determine if it is possible to do this with my system, and how can I arrange for a particular USB device, i.e. this enclosure, to always be treated this way?

    I'm running ubuntu 10.10.

    update

    Discovered this ubuntuforums thread which suggests to use acpitool -w to determine the available wake-up level for the USB controller.

    Running this on my system shows S1 for the USB controllers:

    $ acpitool -w
       Device   S-state   Status   Sysfs node
      ---------------------------------------
      1. LID      S3    *enabled   
      2. PBTN     S4    *enabled   
      3. PCI0     S3    *disabled  no-bus:pci0000:00
      4. USB0     S1    *disabled  pci:0000:00:1d.0
      5. USB1     S1    *disabled  pci:0000:00:1d.1
      6. USB2     S1    *disabled  pci:0000:00:1d.2
      7. USB3     S1    *disabled  pci:0000:00:1d.7
      8. MODM     S3    *disabled  
      9. PCIE     S4    *disabled  pci:0000:00:1e.0
    

    Which seems to be telling me that wake-up capability can only be enabled for USB in the S1 state.

    I'm not sure how useful this is, since providing full power and allowing wake-up may be orthogonal concerns. It may be enabling wake-up only provides low power, so there may be a different way to enable full power.

    If turning on wake-up does equate to providing full power, it looks like I may be able to do what I want by putting a USB card in the expansion slot (I guess that's what PCIE is?). Though I think I'd want to know a bit more about this before attempting to excavate a USB2 PC card.

    • Stefan
      Stefan over 13 years
      this question seems to be a almost duplicate of your other question: unix.stackexchange.com/questions/5343
    • msaif
      msaif over 13 years
      @Stefan: It's an elaboration/clarification of what's sort of a side point on that other post. It's also distinct in that it's focusing more on the system side of things, whereas that question is more about the typical capabilities of the attached devices themselves.
    • msaif
      msaif over 13 years
      @Stefan: Thanks for mentioning that though.. now that I know the landscape a bit better it's clear to me that this should be a separate question, so I've edited that other one.
  • D-Dᴙum
    D-Dᴙum over 7 years
    That link is now dead, do you know if the site was moved or have alternate links?
  • rajaganesh87
    rajaganesh87 over 7 years