none
WdfRequestCreate, WdfRequestReuse and completion routines RRS feed

  • Question

  • Hi,

    there are a few examples in the WDK showing how to split a framework request into parts and generate a new WdfUsbTargetPipeFormatRequestForWrite for each segment. Typical use being reading large data from a USB device which can mybe only handle 1K at a time.

    I have a use case where I need to go the other way. I get many small requests and I need to collect the data and when I have enough send a write request to the bulk pipe. I have been trying this with a locally created Request. The collected request can be up to 4K and must be able to be split back into multiple smaller requests (e.g. 4x 1K) again.

    1) When do I have to call WdfRequestReuse on my driver generated request? When it has fully completed (as the above examples) or each time I issue a new WdfUsbTargetPipeFormatRequestForWrite?

    2) If I have a context extension attached to my driver generated request, does this get 'cleaned' or any way invalidated on a call to WdfRequestReuse or can I rely on it keeping the information (e.g. current buffer position) until the driver generated request is destroyed? Or does this also have to be reassigned and re-initialised?

    Thanks,

    Charles

    Friday, December 6, 2013 2:02 AM

Answers

  • You should call Reuse() after sent request has completed and you want to send it again. The context is cleaned up when the object is deleted, not on Reuse() (you could have easily seen this by setting a cleanup () routine on the request and see when it is called). You don't need to break apart buffers at the granularity you describe, you can send buffers megabytes in size

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, December 6, 2013 6:23 AM