From: Egidio [MSFT] on
You should call ResumeIdle only if SuspendIdle succeeds.

In Win7 we fixed a similar bug in the USB core stack. To confirm it is the
same issue, please install Win7 and run pnpdtest on your original driver, it
should work. If this is the case (i.e., USB Vista bug and it only happens
with pnpdtest and not with the real surprise remove), you should be able to
get an WHQL exemption for the Vista OS.

Thx,
Egi.


"dhmot" <dhmot(a)discussions.microsoft.com> wrote in message
news:1B4032CC-5420-4E7F-AEAA-CE79FDDB5101(a)microsoft.com...
> Here is the post-failure WDF driver log for my driver. I'm not sure how
> far
> it was along the failure, but the error code has been reported:
>
> --- start of log ---
> 1: FxVerifierLock::InitializeLockOrder - Object Type 0x1036 does not have
> a
> lock order defined in fx\inc\FxVerifierLock.hpp
> 2: FxVerifierLock::InitializeLockOrder - Object Type 0x1036 does not have
> a
> lock order defined in fx\inc\FxVerifierLock.hpp
> 3: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7A6C4A98 !devobj 0x9CCBEC70
> entering PnP State WdfDevStatePnpInit from WdfDevStatePnpObjectCreated
> 4: FxPkgPnp::Dispatch - WDFDEVICE 0x7A6C4A98 !devobj 0x9CCBEC70,
> IRP_MJ_PNP,
> 0x00000000(IRP_MN_START_DEVICE) IRP 0x84CB3E28
> 5: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7A6C4A98 !devobj 0x9CCBEC70
> entering PnP State WdfDevStatePnpInitStarting from WdfDevStatePnpInit
> 6: FxPkgFdo::_PnpStartDeviceCompletionRoutine - PNP start failed with
> 0xc000000e(STATUS_NO_SUCH_DEVICE)
> 7: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7A6C4A98 !devobj 0x9CCBEC70
> entering PnP State WdfDevStatePnpInit from WdfDevStatePnpInitStarting
> ---- end of log ----
>
> I do call WdfDeviceSuspendIdle/ResumeIdle in my driver. However, they are
> always called one after another and are protected by a wait lock. Unlike
> your code, if an error is returned, I still call ResumeIdle. The MSDN
> documentation was not clear on exactly what the side effect of an error
> is.
> These errors are logged, but I see no evidence of an error in my debug
> output. I use the calls to WdfDeviceSuspenIdle/ResumeIdle as a method of
> waking the device from selective suspend or keeping the device out of
> selective suspend.
>
> If I make the code changes you suggest, the PnP test passes. The surprise
> removal callback is invoked, which causes the device to exit selective
> suspend. After that, the logic flows pretty much the same as it did in
> Windows XP.
>
> What information does that provide? Is there anything else I should
> capture?
>
> Thanks,
> Michael
>
> "Egidio [MSFT]" wrote:
>
>> - Yes, log line 330 with error 0xC000000E means: a device which does not
>> exist was specified.
>>
>> - Can you send also your WDF driver log after the failure? !load
>> wdfkd.dll,
>> !wdflogdump <your_driver_name>
>> Of course you need to run the above dbg commands before the driver is
>> removed from the system.
>>
>> - Do you call WdfDeviceSuspendIdle/ResumeIdle in your driver? If so,
>> make
>> sure they are called correctly and in pairs, for example don't call
>> WdfDeviceResumeIdle if you didn't call WdfDeviceSuspendIdle. Remember
>> also
>> that these calls are counted.
>>
>> - Try the following code in the surprise removal callback, to make sure
>> the
>> device is in D0 and run the test again.
>> VOID
>> EvtDeviceSurpriseRemoval (
>> __in WDFDEVICE Device
>> )
>> {
>> NTSTATUS status;
>>
>> status = WdfDeviceStopIdle(Device, TRUE);
>> if (NT_SUCCESS(status)) {
>> resumeIdle = TRUE;
>> }
>> }
>>
>> Plus add the following in the DoExit callback:
>> if (resumeIdle) {
>> WdfDeviceResumeIdle(Device);
>> }
>>
>> - Yes, http://support.microsoft.com/kb/314743 is for XP and before, in
>> Vista
>> you have the following changes:
>> For Vista, the debug symbol in USBCCGP is dbgLevel. USBHUB debug
>> output
>> is via WPP only.
>> Before starting to enable these traces let's see the results for above
>> tests.
>>
>> Thx,
>> Egi
>>
>> "dhmot" <dhmot(a)discussions.microsoft.com> wrote in message
>> news:584EDD97-651D-41C3-BE14-D3C211686141(a)microsoft.com...
>> > My device is a high speed device. I disabled the EHCI, which caused
>> > the
>> > device to enumerate at full speed. When I run the PnP test under this
>> > condition, I get the same results, and the log file looks very similar.
>> >
>> > I'm selecting the same PnP DTM test on both XP and Vista. However, I
>> > do
>> > not
>> > know what DTM is doing behind the scenes.