USB Device Power States
This topic describes the WDM device states to use for USB device power states as specified in section 9.1 of the Universal Serial Bus 2.0 specification.
USB device power states (as specified in section 9.1 of the Universal Serial Bus 2.0 specification) can be grouped into three general categories:
- Attached: The device is attached, but not fully powered.
- Powered: The device is in one of the fully powered states: Default, Address, or Configured.
- Suspended: The device is the Idle state and operating on low power.
There is no direct correlation between the device power states defined in the WDM power model and the device power states defined in the USB standard. For example, the terms suspended and idle have very specific meanings in the USB specification; however these terms are often used differently in the WDM power model. Windows client drivers can put a USB device in the Suspended state. For more information, see USB Selective Suspend. When a client driver is ready to suspend its device, it instructs the bus driver to idle it. For a discussion of idle requests, see USB Selective Suspend.
Device power states in the WDM model can be summarized as follows:
- D0 - The working state. The device is fully powered.
- D1/D2 - The intermediate sleep states. These states allow the device to be armed for remote wakeup.
- D3 - The deepest sleep state. Devices in state D3 cannot be armed for remote wakeup.
For a complete discussion of device power states in the WDM power model, see Device Power States.
The WDM power model uses the term arming of devices for remote wakeup. Arming is a software operation that normally, but not always, leads to the hardware operation of enabling the remote wakeup feature on a USB device. The WDM software operation that arms a device for remote wakeup is the wait wake IRP (IRP_MN_WAIT_WAKE). For more information about this IRP, see Supporting Devices that Have Wake-Up Capabilities.
For an explanation of the relationship between this software operation and the enabling of the USB remote wakeup feature, see Remote Wakeup of USB Devices.
This section contains the following sub-sections:
- Changing the Power State of a non-Composite Device
- Changing the Power State of a Composite Device
- Related topics
Changing the Power State of a non-Composite Device
The power policy manager for a USB device is responsible for setting the power state of the device. The power policy manager sets the power state by issuing a WDM power (IRP_MN_SET_POWER) IRP. For more information about the power policy manager, see Power Policy Ownership.
The actions taken by bus driver depend on the device power level that the power policy manager requests. The following lists the actions that the bus driver takes for each level of set power request:
D0
The bus driver performs the following tasks:
- Ensures that all upstream USB hubs are powered and ready to receive requests.
- Resumes the port by clearing the PORT_SUSPEND feature, if the device's USB port is suspended.
- Completes the device's idle IRP with STATUS_SUCCESS, if one is pending.
- Disarm the device for remote wake if it was armed.
D1/D2
The bus driver performs the following tasks:
- Arms the device for remote wakeup, if a wait wake IRP (IRP_MN_WAIT_WAKE) is pending.
- Suspends the device's USB port by setting the PORT_SUSPEND feature.
D3
The bus driver performs the following tasks:
- Suspends the device's USB port by setting the PORT_SUSPEND feature.
- Completes the device's wait wake IRP with STATUS_POWER_STATE_INVALID, if one is pending.
- Completes the device's idle IRP (IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION) with STATUS_POWER_STATE_INVALID, if one is pending.
Changing the Power State of a Composite Device
A client driver for an interface on a composite device must share the power state of the composite device with the client drivers for the other interfaces on the device. Therefore a client driver for an interface cannot put the composite device into a lower power state without affecting other interfaces on the device. The USB Generic Parent Driver (Usbccgp.sys) takes the following actions when an interface's client driver sends an IRP_MN_SET_POWER request.
D0
The bus driver performs the following tasks:
- Ensures that all upsteam USB hubs are powered and ready to receive requests.
- Resumes the port by clearing the PORT_SUSPEND feature, if the device's USB port is suspended.
- Completes the client driver's idle IRP with STATUS_SUCCESS, if one is pending.
D1/D2
The bus driver takes no action.
D3
The bus driver performs the following tasks:
- Completes the client driver's wait wake IRP (IRP_MN_WAIT_WAKE) with STATUS_POWER_STATE_INVALID, if one is pending.
- Completes the client driver's idle IRP (IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION) with STATUS_POWER_STATE_INVALID, if one is pending.
The generic parent driver suspends the USB port for the device when one of the following conditions is true:
- The system is transitioning to a lower power state.
- The client drivers for all functions on the composite device have initiated selective suspend.