Calling the USB Stack

Hi All,
I have a driver that builds a URB attaches it to an IRP then calls the USB driver through IoCallDriver().
Before calling the USB driver, I set the completion routine in the IRP to a routine within my driver.

Every couple of hundred calls, the USB driver seems to stall the irp and it sits uncompleted forever which in turn makes my driver appear to hang.

When I first became suspicious of this I installed simple counters to measure how many calls to IoCallDriver() I have made and how many calls my completion routine received. Sure enough, when this situation occurs, the two counts are out by 1.

I dug further and used the !irp command in windbg and found that the irp was sitting uncompleted.

Lastly, I AM checking the return value from IoCallDriver() to ensure that STATUS_PENDING is being returned.

Any suggestions on how I can debug this further?

Regards, Mark

Do you know if your device is responding to the USB transaction that the URB
generated? What is happening on the bus?

Marc Reinig
System Solutions

“Mark Thompson” wrote in message
news:xxxxx@ntdev…

Hi All,
I have a driver that builds a URB attaches it to an IRP then calls the USB
driver through IoCallDriver().
Before calling the USB driver, I set the completion routine in the IRP to a
routine within my driver.

Every couple of hundred calls, the USB driver seems to stall the irp and it
sits uncompleted forever which in turn makes my driver appear to hang.

When I first became suspicious of this I installed simple counters to
measure how many calls to IoCallDriver() I have made and how many calls my
completion routine received. Sure enough, when this situation occurs, the
two counts are out by 1.

I dug further and used the !irp command in windbg and found that the irp was
sitting uncompleted.

Lastly, I AM checking the return value from IoCallDriver() to ensure that
STATUS_PENDING is being returned.

Any suggestions on how I can debug this further?

Regards, Mark

If your hardware is not responding or its a long term IRP and you want to
revoke an IRP, you should cancel it using IoCancelIrp().


Nar Ganapathy
Windows Core OS group
This posting is provided “AS IS” with no warranties, and confers no rights.

“Marc Reinig” wrote in message news:xxxxx@ntdev…
>
> Do you know if your device is responding to the USB transaction that the
URB
> generated? What is happening on the bus?
>
> Marc Reinig
> System Solutions
>
> “Mark Thompson” wrote in message
> news:xxxxx@ntdev…
>
>
>
> Hi All,
> I have a driver that builds a URB attaches it to an IRP then calls the USB
> driver through IoCallDriver().
> Before calling the USB driver, I set the completion routine in the IRP to
a
> routine within my driver.
>
> Every couple of hundred calls, the USB driver seems to stall the irp and
it
> sits uncompleted forever which in turn makes my driver appear to hang.
>
> When I first became suspicious of this I installed simple counters to
> measure how many calls to IoCallDriver() I have made and how many calls my
> completion routine received. Sure enough, when this situation occurs, the
> two counts are out by 1.
>
> I dug further and used the !irp command in windbg and found that the irp
was
> sitting uncompleted.
>
> Lastly, I AM checking the return value from IoCallDriver() to ensure
that
> STATUS_PENDING is being returned.
>
> Any suggestions on how I can debug this further?
>
> Regards, Mark
>
>
>
>
>
>