USB Target Send and Forget

HELP!

I can’t seem to get an input write Requst, format it for a bulk pipe, and then send it down the USB stack using Send and Forget.

It seems that WdfRequestSend is hammering the stack location that WdfUsbTargetPipeWhateverTheRestOfTheNameIs has previously set up.

I cannot see what I am doing wrong.

Help??

Fred

status = WdfUsbTargetPipeFormatRequestForWrite(devContext->BulkOutPipe,
Request,
requestMemory,
NULL);
if(!NT_SUCCESS(status)){
WdfRequestComplete(Request, status);
return;
}

WDF_REQUEST_SEND_OPTIONS_INIT(&sendOptions,
WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET);

if (!WdfRequestSend(Request,
WdfUsbTargetPipeGetIoTarget(devContext->BulkOutPipe),
&sendOptions)) {
status = WdfRequestGetStatus(Request);
WdfRequestComplete(Request, status);
return;
}

Send and forget means “I didn’t do anything with this irp, behave as if
I didn’t exist in the device stack”. That means that it skips the
current stack location and reuses it for the next driver in the stack.
Your formatting uses the next stack location, which means that it is
lost b/c the current stack location pointer will be wrong when the
usbhub sees the request. Furthermore, you can only send and forget
requests you created yourself, if Request is a WDFQUEUE presented
request, you must set a completion routine so that you can complete the
request later when it travels up the stack.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Wednesday, May 09, 2007 2:21 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB Target Send and Forget

HELP!

I can’t seem to get an input write Requst, format it for a bulk pipe,
and then send it down the USB stack using Send and Forget.

It seems that WdfRequestSend is hammering the stack location that
WdfUsbTargetPipeWhateverTheRestOfTheNameIs has previously set up.

I cannot see what I am doing wrong.

Help??

Fred

status =
WdfUsbTargetPipeFormatRequestForWrite(devContext->BulkOutPipe,
Request,
requestMemory,
NULL);
if(!NT_SUCCESS(status)){
WdfRequestComplete(Request, status);
return;
}

WDF_REQUEST_SEND_OPTIONS_INIT(&sendOptions,

WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET);

if (!WdfRequestSend(Request,

WdfUsbTargetPipeGetIoTarget(devContext->BulkOutPipe),
&sendOptions)) {
status = WdfRequestGetStatus(Request);
WdfRequestComplete(Request, status);
return;
}


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

xxxxx@gmail.com wrote:

I can’t seem to get an input write Requst, format it for a bulk pipe, and then send it down the USB stack using Send and Forget.

It seems that WdfRequestSend is hammering the stack location that WdfUsbTargetPipeWhateverTheRestOfTheNameIs has previously set up.

I cannot see what I am doing wrong.

What is the “failure mode”, as they say? There’s nothing obviously
wrong in this code fragment.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Doron Holan wrote:

Furthermore, you can only send and forget requests you created
yourself, if Request is a WDFQUEUE presented request, you must
set a completion routine so that you can complete the request
later when it travels up the stack.

What’s the effect of not using SEND_AND_FORGET but also not setting a completion routine? Is this officially sanctioned?

You need to set a completion routine if it is not send and forget for a
wdfqueue presented request. The reason you need to provide a completion
routine is that unlike WDM where if you don’t set a c.r. the irp
completes back to the i/o manager, you must explicitly complete a
request in KMDF so that it completes back to the i/o manager. If you
don’t set a c.r. you will have no way of knowing when to call
WdfRequestComplete on the request.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Wednesday, May 09, 2007 5:22 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB Target Send and Forget

Doron Holan wrote:

Furthermore, you can only send and forget requests you created
yourself, if Request is a WDFQUEUE presented request, you must
set a completion routine so that you can complete the request
later when it travels up the stack.

What’s the effect of not using SEND_AND_FORGET but also not setting a
completion routine? Is this officially sanctioned?


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer