Question about Mass Storage and Bus Driver

Hi All:

Currently we are working on a USB bus driver which should be able to
handle the usb mass storage device on it. However, we meet a problem
when the device returns “STALL” at “read CSW from Bulk-In EP” state.

According to Bulk-Only Transport Specification, the correct way to handle
“stall” is :
1.Clear Stall condition
2.Attempt to read CSW from bulk-In endpoint

In most cases, the CSW will be read successfully at 2nd try.

However, in our bus driver, when I clear the stall condition and use
“STATUS_UNSUCCESSFUL” to complete the IRP (I know it by using
a filter driver to snoop the process when a usb disk directly connect
to PC), the Windows USBStor.sys doesn’t issue a bulk-in to get the
CSW again as expect. Instead, it issues a bulk-out request which
contents last failed USB Mass Storage command (MODE_SENSE,
for example).

Can anyone tell me how to make things right ? Or where can I get
something to know USBStor.sys more ?

Any suggestion is appreciated. Thanks a lot.

Smore