Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


USB device with wake up capability is not able to wake up the computer from Modern Standby

Stefan_BorosStefan_Boros Member Posts: 2

I have a USB composite device (one winusb interface - winusb.sys, one uvc interface - usbvideo.sys) capable of waking up the host from S3 state using the winusb interface. On host side, I have my system service able to communicate with the device, so after RESUME everything is ok on the computers without Modern Standby.
On the computers with Modern Standby the behavior is different. My device sends the wake up packet (I saw this in my device's UART port) then, in the BeagleBone Protocol Analyzer traces I see:

  • the bus is resumed from its suspended state without resetting the device
  • the bus enters in the high-speed signaling mode
  • the host sends Clear Device Feature - Remote Wake
  • the device starts and sends descriptors information messages (BOS descriptors - Get String Descriptor)
  • 1 second after last Control Transfer message, the host sends Set Device Feature - Remote Wake and the bus enters in SUSPEND (lots of SOFs between).

As a user, it looks the host doesn't wake up (the screen is still off). My system service, which communicates with the device, doesn't wake up even if, from DAM (Desktop Activity Moderator ) point of view, it is in Session 0 group.
On the other hand, the computer wakes up from Modern Standby using an external USB keyboard or the embedded finger print sensor.
Any hints where to look and what to check? Any tool I can use to be sure that my wake up packet is reaching the winusb driver?

Comments

  • Stefan_BorosStefan_Boros Member Posts: 2

    I succeeded to take traces with logman in winusb and usbccgp drivers. I tried to compare the similar traces from a computer with modern standby and one without modern standby. And they are completely different when my device triggers the wake up:

    • without modern standby
      00008099 winusb 4 6964 4 0 07\22\2022-13:08:49:242 Starting Read Io Target for WdfUsbPipe (00006AF6F1B6B208)
      00008100 winusb 852 14756 7 0 07\22\2022-13:08:49:600 IOCTL_WINUSB_QUERY_DEVICE_INFORMATION
      00008101 winusb 852 14756 7 0 07\22\2022-13:08:49:600 IOCTL_WINUSB_VERSION_EXCHANGE
      00008102 winusb 852 14756 7 0 07\22\2022-13:08:49:600 IOCTL_WINUSB_GET_DESCRIPTOR
      00008103 winusb 852 14756 4 0 07\22\2022-13:08:49:600 IOCTL_WINUSB_GET_DESCRIPTOR
      00008104 winusb 852 14756 4 0 07\22\2022-13:08:49:600 IOCTL_WINUSB_GET_DESCRIPTOR
      00008105 winusb 852 14756 4 0 07\22\2022-13:08:49:600 IOCTL_WINUSB_RESET_DEFAULTS
      00008106 winusb 852 14756 6 0 07\22\2022-13:08:49:601 IOCTL_WINUSB_GET_DESCRIPTOR
      00008107 winusb 852 14756 6 0 07\22\2022-13:08:49:601 IOCTL_WINUSB_GET_DESCRIPTOR

    • with modern standby
      00017635 winusb 4 37320 5 0 07\22\2022-11:27:04:396 Handling Device Cleanup (000027F467C3A708)
      00017636 winusb 4 34752 4 0 07\22\2022-11:27:04:653 DriverObject 0xFFFFD80B9FAE8A70
      00017637 winusb 4 34752 4 0 07\22\2022-11:27:04:653 ResetPortEnabled is set to FALSE
      00017638 winusb 4 34752 4 0 07\22\2022-11:27:04:653 CyclePortEnabled is set to FALSE
      00017639 winusb 4 34752 4 0 07\22\2022-11:27:04:653 Default PowerPolicy: WinUSB is the power policy owner.
      00017640 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PowerPolicy: EnableIdle = 0x00000001(true)
      00017641 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PowerPolicy: SystemWakeEnabled = 0x00000001(true)
      00017642 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PowerPolicy: SuspendDelay = 100 ms
      00017643 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PowerPolicy: DeviceIdleEnabled = 0x00000001(true)
      00017644 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PowerPolicy: UserSetDeviceIdleEnabled = 0x00000000(false)
      00017645 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PowerPolicy: DefaultDeviceIdleState = 0x00000001(true)
      00017646 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PowerPolicy: IdleConfigured = 0x00000000(false)
      00017647 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PipePolicy: ShortPacketTerminate = 0x00000000(false)
      00017648 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PipePolicy: AutoClearStall = 0x00000000(false)
      00017649 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PipePolicy: PipeTransferTimeout = 0
      00017650 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PipePolicy: IgnoreShortPackets = 0x00000000(false)
      00017651 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PipePolicy: AllowPartialReads = 0x00000001(true)
      00017652 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PipePolicy: AutoFlush = 0x00000000(false)
      00017653 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PipePolicy: RawIo = 0x00000000(false)
      00017654 winusb 4 34752 4 0 07\22\2022-11:27:04:654 Default PipePolicy: ResetOnResume = 0x00000000(false)
      00017655 winusb 4 34752 7 0 07\22\2022-11:27:04:665 Preparing hardware for WDF device (000027F46845F4C8)
      00017656 winusb 4 34752 0 0 07\22\2022-11:27:04:666 Created UsbDevice (000027F46C859F98)
      00017657 winusb 4 34752 0 0 07\22\2022-11:27:04:667 Resetting Default settings for WDFDevice (000027F46845F4C8)
      00017658 winusb 4 34752 0 0 07\22\2022-11:27:04:667 Starting Read Io Target for WdfUsbPipe (000027F45C216AF8)
      00017659 winusb 4 31308 3 0 07\22\2022-11:27:05:677 Stopping Read Io Target for WdfUsbPipe (000027F45C216AF8) to cancel pending IO

    I think this is a dead end. I have no idea where to focus. Any hints?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 12 September 2022 Live, Online
Internals & Software Drivers 23 October 2022 Live, Online
Kernel Debugging 14 November 2022 Live, Online
Developing Minifilters 5 December 2022 Live, Online