KMDF Decision Processes

I came across an interesting case here that could be considered a minor
flaw in KMDF.

Here’s the issue. I have a client with a composite USB device. Four
interfaces are UVC, one interface is WinUSB. The UVC interfaces go into
D3 when idle, but the WinUSB interface will only go to D2, and that
means the whole composite device will only go into D2. This is a
well-known WinUSB thing, if subtle.

I wrote a little upper filter driver to be the power policy owner, and
told WinUSB (through the registry) that it was no longer the owner. I
set up the power properties to go into D3 after a 5-second idle period.
That worked, and it did, indeed, go into D3. However, it never came out
if D3, so I couldn’t send any new requests.

The actual problem is described in the documentation for
WDF_IO_QUEUE_CONFIG: When you have a power-managed queue, where
PowerManaged is set to WdfDefault, the framework handles power
management for the queue unless the driver calls WdfFdoInitSetFilter.
Well, I certainly did call SetFilter, but I also called
WdfDeviceInitSetPowerPolicyOwnership.

I think you could reasonably argue that the WdfDefault case for
PowerManaged ought to take into consideration the
SetPowerPolicyOwnership flag. My fix was easy – I just set
PowerManaged to WdfTrue – but I’m not sure I should have to.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.