Hi Dean,
From your below info it looks like you have the correct settings assuming
that winusb.sys is the power policy owner for your USB device. To make sure
can you please do the below kernel debugger commands (I am assuming you are
using WinDbg):
1) Break into the debugger and set your symbols to point to MS symbol
server.
2) Do a !devnode 0 1 and find your USB device in the list. For example I
have a OSR USB-FX2 device plugged in on my test system:
!devnode 0 1
.
.
.
DevNode 0x89388e78 for PDO 0x89c35150
InstancePath is "USB\VID_0547&PID_1002\5&f86e282&0&4"
ServiceName is "WUDFRd"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
3) Using the above PDO do the below:
!devstack 0x89c35150
.
.
.
!DevObj !DrvObj !DevExt ObjectName
8930f9f8 \Driver\WUDFRd 8930fab0
8936c4b0 \Driver\WinUsb 98364f20
89c35150 \Driver\usbhub 89c35208 USBPDO-10
!DevNode 89388e78 :
DeviceInst is "USB\VID_0547&PID_1002\5&f86e282&0&4"
ServiceName is "WUDFRd"
4) Using the WinUSB !DevExt value, do the below:
dt 98364f20 winusb!_device_extension -r
.
.
.
+0x000 UsbDevice : 0x67c6d118 WDFUSBDEVICE__
+0x000 unused : ??
+0x004 UsbDeviceInformation : _WDF_USB_DEVICE_INFORMATION
+0x000 Size : 0x14
+0x004 UsbdVersionInformation : _USBD_VERSION_INFORMATION
+0x000 USBDI_Version : 0x600
+0x004 Supported_USB_Version : 0x200
+0x00c HcdPortCapabilities : 0
+0x010 Traits : 6
+0x018 PowerPolicyLock : 0
+0x01c DeviceDescriptor : 0x8930b328 _USB_DEVICE_DESCRIPTOR
+0x000 bLength : 0x12 ''
+0x001 bDescriptorType : 0x1 ''
+0x002 bcdUSB : 2
+0x004 bDeviceClass : 0 ''
+0x005 bDeviceSubClass : 0 ''
+0x006 bDeviceProtocol : 0 ''
+0x007 bMaxPacketSize0 : 0x40 '@'
+0x008 idVendor : 0x547
+0x00a idProduct : 0x1002
+0x00c bcdDevice : 0
+0x00e iManufacturer : 0x1 ''
+0x00f iProduct : 0x2 ''
+0x010 iSerialNumber : 0 ''
+0x011 bNumConfigurations : 0x1 ''
+0x020 ConfigurationDescriptor : 0x89cd28c8 _USB_CONFIGURATION_DESCRIPTOR
+0x000 bLength : 0x9 ''
+0x001 bDescriptorType : 0x2 ''
+0x002 wTotalLength : 0x27
+0x004 bNumInterfaces : 0x1 ''
+0x005 bConfigurationValue : 0x1 ''
+0x006 iConfiguration : 0x4 ''
+0x007 bmAttributes : 0xa0 ''
+0x008 MaxPower : 0x32 '2'
+0x024 ConfigurationHandle : (null)
+0x028 InterfaceMutex : _FAST_MUTEX
+0x000 Count : 1
+0x004 Owner : (null)
+0x008 Contention : 0
+0x00c Event : _KEVENT
+0x000 Header : _DISPATCHER_HEADER
+0x01c OldIrql : 0
+0x048 InterfaceCount : 0x1 ''
+0x04c Interfaces : 0x892880f0 _WINUSB_INTERFACE
+0x000 InterfaceNumber : 0 ''
+0x001 CurrentAltSetting : 0 ''
+0x004 WdfInterface : 0x67c6f060 WDFUSBINTERFACE__
+0x000 unused : ??
+0x008 PipeCount : 3
+0x00c Pipes : [32] 0x89c7b6c0 _PIPE
+0x000 PipeInformation : _WDF_USB_PIPE_INFORMATION
+0x014 PipePolicy : _WINUSB_PIPE_POLICY
+0x024 PipePolicyLock : 0
+0x028 IoQueue : (null)
+0x02c RemainderPacket : _PACKET
+0x038 CurrentRequest : (null)
+0x03c RequestCancelled : 0 ''
+0x040 CompleteOrder : 0
+0x044 CompleteStatus : 0
+0x048 ReadRequest : (null)
+0x04c MaxTransferSize : 0
+0x050 ErrorLock : 0
+0x054 HandlingError : 0
+0x058 ErrorQueue : _LIST_ENTRY [ 0x0 - 0x0 ]
+0x060 ErrorWorkItem : (null)
+0x064 WdfUsbPipe : (null)
+0x050 Opened : 0x1 ''
+0x054 InterfaceGuidCollection : 0x6d00d058 WDFCOLLECTION__
+0x000 unused : ??
+0x058 IsPowerPolicyOwner : 0x1 ''
+0x05c PowerPolicy : _WINUSB_POWER_POLICY
+0x000 EnableIdle : 0 ''
+0x004 SuspendDelay : 0
+0x008 DeviceIdleEnabled : 0 ''
+0x009 UserSetDeviceIdleEnabled : 0 ''
+0x00a DeviceIdleIgnoreWake : 0 ''
+0x00b DefaultDeviceIdleState : 0 ''
+0x00c SystemWakeEnabled : 0 ''
+0x010 IdleSettings : _WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS
+0x000 Size : 0
+0x004 IdleCaps : 0 ( IdleCapsInvalid )
+0x008 DxState : 0 ( PowerDeviceUnspecified )
+0x00c IdleTimeout : 0
+0x010 UserControlOfIdleSettings : 0 ( IdleUserControlInvalid )
+0x014 Enabled : 0 ( WdfFalse )
+0x018 PowerUpIdleDeviceOnSystemWake : 0 ( WdfFalse )
+0x088 IdleConfigured : 0x1 ''
+0x08c DefaultPowerPolicy : _WINUSB_POWER_POLICY
+0x000 EnableIdle : 0 ''
+0x004 SuspendDelay : 0
+0x008 DeviceIdleEnabled : 0 ''
+0x009 UserSetDeviceIdleEnabled : 0 ''
+0x00a DeviceIdleIgnoreWake : 0 ''
+0x00b DefaultDeviceIdleState : 0 ''
+0x00c SystemWakeEnabled : 0 ''
+0x010 IdleSettings : _WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS
+0x000 Size : 0
+0x004 IdleCaps : 0 ( IdleCapsInvalid )
+0x008 DxState : 0 ( PowerDeviceUnspecified )
+0x00c IdleTimeout : 0
+0x010 UserControlOfIdleSettings : 0 ( IdleUserControlInvalid )
+0x014 Enabled : 0 ( WdfFalse )
+0x018 PowerUpIdleDeviceOnSystemWake : 0 ( WdfFalse )
+0x0b8 DefaultPipePolicy : _WINUSB_PIPE_POLICY
+0x000 ShortPacketTerminate : 0 ''
+0x001 AutoClearStall : 0 ''
+0x004 PipeTransferTimeout : 0
+0x008 IgnoreShortPackets : 0 ''
+0x009 AllowPartialReads : 0x1 ''
+0x00a AutoFlush : 0 ''
+0x00b RawIo : 0 ''
+0x00c ResetOnResume : 0 ''
+0x0c8 DefaultAlternateSetting : 0 ''
+0x0cc RequestCount : 0xe
+0x0d0 ResetPortEnabled : 0
+0x0d4 CyclePortEnabled : 0
+0x0d8 DllVersion : 0x100
+0x0da Configured : 0x1 ''
+0x0dc AbortQueue : 0x67ca71f8 WDFQUEUE__
+0x000 unused : ??
5) Please reply back with the data respective to your USB device so I can
take a look at your USB device's power policy settings.
Thanks,
-Don[MS]
Hi again, I make a test.
Windows Vista sp2
Intel Core2 Duo CPU E8300
4G RAM
32-bit Operating system
WdfCoInstaller01007.dll
WinUSBCoInstaller.dll
HKR,,"DeviceIdleEnabled",0x00010001,1
HKR,,"DeviceIdleIgnoreWakeEnable",0x00010001,1
HKR,,"UserSetDeviceIdleEnabled",0x00010001,1
HKR,,"DefaultIdleState",0x00010001,1
HKR,,"DefaultIdleTimeout",0x00010001,5000
Catch USB interrupt, and print the interrupt source to RS232.
If value = 0x80, the interrupt source is Suspend signaling on the bus.
I plug in a USB device to my PC, later I disable the USB hub in device
manager. (This senario simulate PC is standby or sleep.)
RS232 print 0x80, and the current of the usb device is power down, change
from 25mA to 2.5mA. The selective suspend is working.
I plug in a USB device to my PC, I don't open any client software to read or
write to this USB device for more than 5 seconds (I set the idle timeout to 5
seconds:HKR,,"DefaultIdleTimeout",0x00010001,5000).
RS232 print nothing, and the current of the usb device is remain 25mA. The
selective suspend is not working.
I plug in a USB device to my PC, I open any client software write a message
frame to this USB device, and read an expected message frame from the usb
device. And then close my client software(close file handle). Do nothing for
more than 20 seconds.
RS232 print nothing, and the current of the usb device is remain 25mA. The
selective suspend is not working.
Using WinUSB as my driver, I would like to make my USB device be able to
suspend while PC is running normally. But when the USB device is idle, WinUSB
does not generate suspend signal, so I couldn't execute suspend command(some
save power command) in my USB device firmware. I can only do it when PC is
standby. I think I miss something, I need help. Thank for any help.