On Mon, 26 Dec 2005 [EMAIL PROTECTED] wrote:
> Hi all,
> I am new to power management in Linux. I was wondering what if I want to
> suspend a particular USB device without suspending the system as a whole
> and after sometime resume it? Is that possible in Linux? If possible
> then can anyone suggest me how to do that? Thanks in advance. I am
> looking forward to your suggestions.
It is possible in modern Linux versions. To suspend a device, you can do:
echo -n 3 >/sys/bus/usb/devices/[device-name]/power/state
Any other sysfs path that ends up in the same location would obviously
work just as well. Perhaps 2 instead of 3 would be slightly better, but I
think either one will be okay. Note that before you can do this, you may
have to suspend all the device's interfaces. And if the device you want
to suspend is a hub, you have to suspend all the hub's child devices
first.
So for example, I have a USB flash disk attached at 1-1 (i.e., bus 1, port
1). It has a single interface, named 1-1:1.0. To suspend it, I can do:
echo -n 3 >/sys/bus/usb/devices/1-1:1.0/power/state
echo -n 3 >/sys/bus/usb/devices/1-1/power/state
To resume, use 0 instead of 3. And of course, resume the device before
resuming its interfaces:
echo -n 0 >/sys/bus/usb/devices/1-1/power/state
echo -n 0 >/sys/bus/usb/devices/1-1:1.0/power/state
You can see the current power state by cat'ing the .../power/state file.
Note that at some time in the future the state names will probably change
from arbitrary numbers to meaningful strings. There's a good chance, for
instance, that you will eventually have to do
echo -n suspend >/sys/bus/...
and
echo -n on >/sys/bus/...
However this hasn't happened yet.
Alan Stern
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel