Hi
I have a USB driver that needs to stream data from the target device as fast as possible and so have set up a WDF continuous reader.
I can’t guarantee that there will be pending Read Requests available to transfer the resultant data up to the application layer when the continuous reader returns so have built a small queue in the driver to buffer the incoming data. When a read request does come in, I check this small queue for available data and if present copy the data into the request’s output buffer and complete.
This all works fine unless/until the small queue fills up. Ideally at this point I would like to pause the continuous reader and then re-enable it once the queue has been partially emptied. The hardware can cope with reasonably long periods without transfers (a few seconds) but we can’t deal with lost data - so we need to pause the data flow otherwise we end up binning the incoming data.
The driver detects that the queue has filled up in the EvtUsbTargetPipeReadComplete function but this is typically running at DISPATCH_LEVEL so we can’t stop the reader from here. Is there a way I could tell the driver to stop the reader when it returns to PASSIVE_LEVEL? Should the reader be stopped and started at all outside of the D0 power event handlers? Would it be better to send a signal to the hardware to tell it to stop transmitting and if so how can you post to your own IOCTL queue (through which we normally talk to the device using vendor commands) from DISPATCH_LEVEL?
Any help gratfully appreciated!
cheers
James