Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way that I can power off a (specific) USB device completely using software from a Linux machine?

I want to use this to power off (so that the LED is off) a (single) USB stick.

Do you know any method to achieve this? E.g. using /sys/bus/usb or the like?

share|improve this question
    
Yes. Simply unmount the device. –  iglvzx Dec 23 '11 at 19:02
    
No, that doesn't help. There is also the possibility that there are no usable partitions (which could be mounted) on the stick. –  Daniel Jour Dec 24 '11 at 0:25

2 Answers 2

up vote 3 down vote accepted

If your machine runs old kernel, you could issue echo suspend > /sys/bus/usb/devices/X-X/power/level to force suspension of device.

However, since 2.6.32 this is no longer possible:

We can categorize power management events in two broad classes: external and internal. External events are those triggered by some agent outside the USB stack: system suspend/resume (triggered by userspace), manual dynamic resume (also triggered by userspace), and remote wakeup (triggered by the device). Internal events are those triggered within the USB stack: autosuspend and autoresume. Note that all dynamic suspend events are internal; external agents are not allowed to issue dynamic suspends.

power/control

    This file contains one of two words: "on" or "auto".
    You can write those words to the file to change the
    device's setting.

    "on" means that the device should be resumed and
    autosuspend is not allowed.  (Of course, system
    suspends are still allowed.)

    "auto" is the normal state in which the kernel is
    allowed to autosuspend and autoresume the device.

    (In kernels up to 2.6.32, you could also specify
    "suspend", meaning that the device should remain
    suspended and autoresume was not allowed.  This
    setting is no longer supported.

(from http://www.kernel.org/doc/Documentation/usb/power-management.txt)

I guess the best thing you can do is to unbind device from driver, so there would be no activity on it, and then configure the device to autosuspend as soon as possible (echo auto > /sys/bus/usb/devices/X-X/power/control && echo 0 > /sys/bus/usb/devices/X-X/power/autosuspend_delay_ms).

However, as far as I understand USB specs, even if you suspend the device, some power on port will remain, so it might be impossible to disable led if it is powered by 'dumb' scheme (i.e. directly connected to +5V and GND pins).

share|improve this answer
    
I'm marking this a the accepted answer because I was able to unbind the device from its driver and configure autosuspend, which leads to the device shuting down. Unfortunately, the targeted USB sticks (or: their LEDs) are directly connected to +5V and GND, and therefore cannot be powered down. –  Daniel Jour Jan 21 '13 at 4:13

Using the eject command should work.

Run eject /dev/<devicename> and it should power down.

share|improve this answer
    
Unfortunately, this doesn't work for my test stick here :( –  Daniel Jour Dec 24 '11 at 0:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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