From: Denny on
Thanks Doron. It's indeed a great news for me. I appriciate your help on this.
--Denny


"Doron Holan [MS]" wrote:

> we (the KMDF team) are investigating this issue.
>
> thx
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Denny" <Denny(a)discussions.microsoft.com> wrote in message
> news:0CD588CF-5CE8-4326-8F1E-A8FF45D7B42B(a)microsoft.com...
> > Hi Maxim,
> > Thanks to remind me that.But my driver is a WDF driver and I don't handle
> > any IOCTL's other than my device specific Read/Write.My driver is build
> > upon
> > the OSR usb sample in the KMDF1.0 and the only modification I did is to
> > handle the IOCTL handling for the vendor specific read and write
> > --Denny
> >
> >
> > "Maxim S. Shatskih" wrote:
> >
> >> Remember: you must delete your symlinks and deactivate your device
> >> interfaces in SURPRISE_REMOVAL path and not in REMOVE_DEVICE. Doing
> >> otherwise
> >> leads to a collision if the app holds an open handle to the device, and
> >> you
> >> unplug it and replug back.
> >>
> >> --
> >> Maxim Shatskih, Windows DDK MVP
> >> StorageCraft Corporation
> >> maxim(a)storagecraft.com
> >> http://www.storagecraft.com
> >>
> >> "Denny" <Denny(a)discussions.microsoft.com> wrote in message
> >> news:B08BA486-F757-4F19-A401-FF4CD90972C3(a)microsoft.com...
> >> > Hope somebody will follow-up on this topic. I was able to run debugview
> >> > while
> >> > running the HCT test for my WDF driver. What I can see is that while
> >> > running
> >> > the USB descriptor test, the test remove the driver (I think an attempt
> >> > to
> >> > reinitalize ) and after that it never comes back. It just hung like
> >> > there is
> >> > no device present. After aborting the test if I try to replug the
> >> > device it
> >> > says there is a prevoius image of the driver is still there in memory.
> >> > I can
> >> > unplug and replug the device as many time as I want with out any issues
> >> > under
> >> > normal circumstances on the same amd system. I think it seems like a
> >> > problem
> >> > with the hct and KMDF. My driver is a simple usb driver for a device
> >> > with an
> >> > interrupt endpoint and a control endpoint.There is no specific memory
> >> > allocations in the device initialization, so I can't suspect resource
> >> > leak
> >> > also pooltag shows allocations are ok and driver verfier pass the
> >> > device
> >> > using the same HCT(12.0.1); any body have any better idea to dig
> >> > further...
> >> > thanks,
> >> > --Denny
> >> >
> >>
> >>
>
>
>
From: Eliyas Yakub [MSFT] on
I tried usbhct.exe on our WDF osrusbfx2 driver and it worked fine.

If the device doesn't come back, disable and reenable the usbhub devnode
instance to which the device is attached, and it should come back. If it
doesn't then your device has some issues.

--
-Eliyas
This posting is provided "AS IS" with no warranties, and confers no rights.
http://www.microsoft.com/whdc/driver/kernel/KB-drv.mspx


From: Denny on
Hi Eliyas,
Thanks for testing it out.
I don't know how to run (usbhct) test from command prompt. Here is the way I
performed my test. As I can see the problem on my 32bit XP sp2 itself.But on
32 bit the test run to completeion that won't happen on the 64-bit.The
following is the sequence.
1. I installed the driver (fresh installation); I can see the installation
is correct and the device manager reports the device working properly(If I go
ahead and use my application the device work flawless. I can uplug and replug
the device as many times as I want and the device got unloaded and reloaded
properly).
2. Now after the install my first operation is to run HCT from fresh. HCT
scan for the devices, find my device and I select the urniversal test group.
I can see the device manager still have my device.I select the USB Descriptor
test and start the test.
3. Test initalises and the device disappears from device manager. Test run
to completion with out errors ,once the test is over device manager comes
back with the device but with error "cannot load driver the previous image
is alreay in memory"
I did try enable and disable of the device, scan for changes, no difference.
the following is the debugview result during testing
00000000 0.00000000 [124]
00000001 0.00000000 [124] writing lastrun log now
00000002 0.00075987 [124]
00000003 0.00081184 [124] USB Descriptor
00000004 0.00097024 [124]
00000005 0.00132475 [124]
00000006 0.00132475 [124] done writing lastrun log now
00000007 0.00161641 [124]
00000008 0.00161641 [124] create process now
00000009 0.04793319 [124]
00000010 0.04793319 [124] CreateProcess succeeded now for 0,7397
00000011 1.27195803 SPYDERSYSUSB: <--SpyderEvtDeviceD0Exit
00000012 1.28221380 SPYDERSYSUSB: --> SpyderEvtDriverContextCleanup
00000013 196.76792609 [124]
00000014 196.76792609 [124] completed process now
00000015 196.78212231 [124]
00000016 196.78212231 [124] entered GetTestResult
00000017 198.22026235 [124]
00000018 198.22026235 [124] finished test run now

4. now I reboot the meachine. System rebooted with the device enumerated
correctly by device manager(in working state withnno errors).
5. Start HCT again, this time no fresh scanning for devices. I continue with
my last test as follows ,I removed the USB descriptor test, add the test back
again and start it.
6. Test initalises, device disappered from the device manager. Test run to
completion without errors and this time my device got re-enumerated properly
by device manager!!!!!
I didn't do any changes other than restart the meachine and perfom the same
test without a rescan by HCT. The following is the debugview result from
second run

00000078 72.17923116 [3592]
00000079 72.17923116 [3592] writing lastrun log now
00000080 72.17977341 [3592]
00000081 72.17982649 [3592] USB Descriptor
00000082 72.17998237 [3592]
00000083 72.18029610 [3592]
00000084 72.18029610 [3592] done writing lastrun log now
00000085 72.18035309 [3592]
00000086 72.18035309 [3592] create process now
00000087 72.22110967 [3592]
00000088 72.22110967 [3592] CreateProcess succeeded now for 0,7397
00000089 74.03645016 SPYDERSYSUSB: <--SpyderEvtDeviceD0Exit
00000090 74.14953353 SPYDERSYSUSB: --> SpyderEvtDriverContextCleanup
00000091 105.63902759 watchdog!WdUpdateRecoveryState: Recovery enabled.
00000092 208.85312714 [1448] QIThunk - 1 Release : Object =
0x00bc3ca8 Refcount = 0
00000093 208.85321235 [1448] CComClassFactory
00000094 208.85346294 [1448] -
00000095 208.85351546 [1448] IUnknown
00000096 208.85366799 [1448]
00000097 269.59493846 [3592]
00000098 269.59493846 [3592] completed process now
00000099 269.59687558 [3592]
00000100 269.59687558 [3592] entered GetTestResult
00000101 270.67292715 *******************************************************************************
00000102 270.67292938 *
00000103 270.67293189 * This is the string you add to your checkin
description
00000104 270.67293441 * Driver Verifier: Enabled for s
00000105 271.02422794 SPYDERSYSUSB: Spyder Driver - Driver Framework Edition.
00000106 271.02423883 SPYDERSYSUSB: Built Apr 11 2006 20:15:05
00000107 271.02523365 SPYDERSYSUSB: --> SpyderEvtDeviceAdd routine
00000108 271.02543340 SPYDERSYSUSB: <-- SpyderEvtDeviceAdd
00000109 271.02691990 SPYDERSYSUSB: --> SpyderEvtDevicePrepareHardware
00000110 271.08110556 SPYDERSYSUSB: <-- SpyderEvtDevicePrepareHardware
00000111 271.08128044 SPYDERSYSUSB: <--SpyderEvtEvtDeviceD0Entry
00000112 271.65349255 [3592]
00000113 271.65349255 [3592] finished test run now

also I'm not connected through a hub. My device is enumerated under the host
controller.I'm working on a WDM version now to see the difference. Hope the
above may help you to identify the issue.
Thanks,
--Denny


"Eliyas Yakub [MSFT]" wrote:

> I tried usbhct.exe on our WDF osrusbfx2 driver and it worked fine.
>
> If the device doesn't come back, disable and reenable the usbhub devnode
> instance to which the device is attached, and it should come back. If it
> doesn't then your device has some issues.
>
> --
> -Eliyas
> This posting is provided "AS IS" with no warranties, and confers no rights.
> http://www.microsoft.com/whdc/driver/kernel/KB-drv.mspx
>
>
>
From: Denny on
Hi all,
More on my testing.Yesterday I created a test version driver from the WDM
usb example for my usb device. While running the HCT with the USB descriptor
I falls into the same behaviour.The test run to success but the driver fails
to load after the test. One interesting point I noticed is that the following
from DebugView
00000092 208.85312714 [1448] QIThunk - 1 Release : Object =
0x00bc3ca8 Refcount = 0
00000093 208.85321235 [1448] CComClassFactory
00000094 208.85346294 [1448] -
00000095 208.85351546 [1448] IUnknown
00000096 208.85366799 [1448]
This happens when every time a test runs (I think HCT allocates this
resource and releases it after the test) . The above is from a sucessfull
driver load after the test(I explained it on my previous post). But on the
failed tests it seems like HCT never releases some the reference objects it
creates after completeing the test.For instance, on a failed scenario,the
above object gets created with a reference count 1 before the test starts but
I don't see the count goes back to zero when it completes the test. Please
let me know how do I proceed from this.
thanks,
--Denny


"Denny" wrote:

> Hi Eliyas,
> Thanks for testing it out.
> I don't know how to run (usbhct) test from command prompt. Here is the way I
> performed my test. As I can see the problem on my 32bit XP sp2 itself.But on
> 32 bit the test run to completeion that won't happen on the 64-bit.The
> following is the sequence.
> 1. I installed the driver (fresh installation); I can see the installation
> is correct and the device manager reports the device working properly(If I go
> ahead and use my application the device work flawless. I can uplug and replug
> the device as many times as I want and the device got unloaded and reloaded
> properly).
> 2. Now after the install my first operation is to run HCT from fresh. HCT
> scan for the devices, find my device and I select the urniversal test group.
> I can see the device manager still have my device.I select the USB Descriptor
> test and start the test.
> 3. Test initalises and the device disappears from device manager. Test run
> to completion with out errors ,once the test is over device manager comes
> back with the device but with error "cannot load driver the previous image
> is alreay in memory"
> I did try enable and disable of the device, scan for changes, no difference.
> the following is the debugview result during testing
> 00000000 0.00000000 [124]
> 00000001 0.00000000 [124] writing lastrun log now
> 00000002 0.00075987 [124]
> 00000003 0.00081184 [124] USB Descriptor
> 00000004 0.00097024 [124]
> 00000005 0.00132475 [124]
> 00000006 0.00132475 [124] done writing lastrun log now
> 00000007 0.00161641 [124]
> 00000008 0.00161641 [124] create process now
> 00000009 0.04793319 [124]
> 00000010 0.04793319 [124] CreateProcess succeeded now for 0,7397
> 00000011 1.27195803 SPYDERSYSUSB: <--SpyderEvtDeviceD0Exit
> 00000012 1.28221380 SPYDERSYSUSB: --> SpyderEvtDriverContextCleanup
> 00000013 196.76792609 [124]
> 00000014 196.76792609 [124] completed process now
> 00000015 196.78212231 [124]
> 00000016 196.78212231 [124] entered GetTestResult
> 00000017 198.22026235 [124]
> 00000018 198.22026235 [124] finished test run now
>
> 4. now I reboot the meachine. System rebooted with the device enumerated
> correctly by device manager(in working state withnno errors).
> 5. Start HCT again, this time no fresh scanning for devices. I continue with
> my last test as follows ,I removed the USB descriptor test, add the test back
> again and start it.
> 6. Test initalises, device disappered from the device manager. Test run to
> completion without errors and this time my device got re-enumerated properly
> by device manager!!!!!
> I didn't do any changes other than restart the meachine and perfom the same
> test without a rescan by HCT. The following is the debugview result from
> second run
>
> 00000078 72.17923116 [3592]
> 00000079 72.17923116 [3592] writing lastrun log now
> 00000080 72.17977341 [3592]
> 00000081 72.17982649 [3592] USB Descriptor
> 00000082 72.17998237 [3592]
> 00000083 72.18029610 [3592]
> 00000084 72.18029610 [3592] done writing lastrun log now
> 00000085 72.18035309 [3592]
> 00000086 72.18035309 [3592] create process now
> 00000087 72.22110967 [3592]
> 00000088 72.22110967 [3592] CreateProcess succeeded now for 0,7397
> 00000089 74.03645016 SPYDERSYSUSB: <--SpyderEvtDeviceD0Exit
> 00000090 74.14953353 SPYDERSYSUSB: --> SpyderEvtDriverContextCleanup
> 00000091 105.63902759 watchdog!WdUpdateRecoveryState: Recovery enabled.
> 00000092 208.85312714 [1448] QIThunk - 1 Release : Object =
> 0x00bc3ca8 Refcount = 0
> 00000093 208.85321235 [1448] CComClassFactory
> 00000094 208.85346294 [1448] -
> 00000095 208.85351546 [1448] IUnknown
> 00000096 208.85366799 [1448]
> 00000097 269.59493846 [3592]
> 00000098 269.59493846 [3592] completed process now
> 00000099 269.59687558 [3592]
> 00000100 269.59687558 [3592] entered GetTestResult
> 00000101 270.67292715 *******************************************************************************
> 00000102 270.67292938 *
> 00000103 270.67293189 * This is the string you add to your checkin
> description
> 00000104 270.67293441 * Driver Verifier: Enabled for s
> 00000105 271.02422794 SPYDERSYSUSB: Spyder Driver - Driver Framework Edition.
> 00000106 271.02423883 SPYDERSYSUSB: Built Apr 11 2006 20:15:05
> 00000107 271.02523365 SPYDERSYSUSB: --> SpyderEvtDeviceAdd routine
> 00000108 271.02543340 SPYDERSYSUSB: <-- SpyderEvtDeviceAdd
> 00000109 271.02691990 SPYDERSYSUSB: --> SpyderEvtDevicePrepareHardware
> 00000110 271.08110556 SPYDERSYSUSB: <-- SpyderEvtDevicePrepareHardware
> 00000111 271.08128044 SPYDERSYSUSB: <--SpyderEvtEvtDeviceD0Entry
> 00000112 271.65349255 [3592]
> 00000113 271.65349255 [3592] finished test run now
>
> also I'm not connected through a hub. My device is enumerated under the host
> controller.I'm working on a WDM version now to see the difference. Hope the
> above may help you to identify the issue.
> Thanks,
> --Denny
>
>
> "Eliyas Yakub [MSFT]" wrote:
>
> > I tried usbhct.exe on our WDF osrusbfx2 driver and it worked fine.
> >
> > If the device doesn't come back, disable and reenable the usbhub devnode
> > instance to which the device is attached, and it should come back. If it
> > doesn't then your device has some issues.
> >
> > --
> > -Eliyas
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> > http://www.microsoft.com/whdc/driver/kernel/KB-drv.mspx
> >
> >
> >