리눅스를 사용하는 노트북에서 Suspend 모드일때 USB 충전하는 방법

By | 2012년 11월 7일

Device and Bus Power Management

USB selective suspend

This is a project in progress for the USB subsystem. USB selective suspend allows you to suspend a USB device on demand. If one device doesn’t support selective suspend, then the entire bus must remain active. This not only consumes USB bus power unnecessarily, but also prevents the CPU from entering lower power states. A white paper describing USB selective suspend can be found here.

Autosuspend on Linux

For a device to be autosuspended in Linux, it must have in-kernel driver support. Currently there are several types of USB devices that have autosuspend support:

  • printers
  • hubs
  • some USB Ethernet devices
  • USB LCDs

Although kernel drivers may support autosuspend, some USB devices may not properly implement autosuspend. These devices may behave in unexpected ways, or simply not work after the kernel attempts to suspend them. Often a physical disconnection from the bus will fix the problem, but only until the kernel attempts to suspend the device again.

If you see these types of problems, please send mail to linux-usb-users@lists.sourceforge.net. Include output from lsusb -v, dmesg output with CONFIG_USB_DEBUG turned on, and a description of the symptoms. We would also appreciate a note that your USB device actually works with autosuspend.

Enabling Autosuspend

To enable autosuspend, you must recompile your kernel with CONFIG_USB_SUSPEND. (As of 2.6.23-rc6, this feature is marked “experimental”.) You may also want to enable CONFIG_USB_DEBUG so you can see suspend and resume messages via dmesg.

Autosuspending USB devices

To attempt to autosuspend your USB device, first use lsusb as root to find out the bus number and device number of your usb device:

Then find your device’s directory in /sys/bus/usb/devices/.  Look in directories that are named with two numbers separated with a dash:

We know the USB to ethernet device’s directory is 1-2 because the device and bus numbers match the lsusb output.  Now we can tell the kernel that it should suspend this device automatically if it is not being used. First we set the idle timeout to 2 seconds:

The timeout can be set to any integer number of seconds.  If set to -1, the device will not autosuspend. Then we make sure the kernel will automatically suspend the device, and resume the device if data needs to be transferred:

Other options to echo to this file are “on” and “suspend”:

  • “on” will force the    device to be on all the time.
  • “suspend” will permanently suspend the device    until the user echoes “on” or “auto” to this file.     (Note that this is a    simplification, since the value of the power/wakeup file may allow the device to    signal a remote wakeup.)

For a more complete description of USB power management, see the file  Documentation/usb/power-management.txt, which is in kernel sources 2.6.24-rc2  and later.

댓글 남기기

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다