I use wdk's usbsamp ,but have some question

thank you ,everybody.

I use wdk’s usbsamp example,and modify it for my camera device,and in my camera device ,it use bulk transfer,and now my application usually run well.
(1) but sometime ,it can not receive any data ,and the pipe RSET,who can tell me why?
(2) I want to set a timeout in ReadWriteBulkEndPoints ,how to do it ?
I find WdfusbTargetDeviceSendControlTransferSynchoronouly function ,and it have a parameterto set timeout ,but in usbsamp,it use asynchronous ,and the function is WdfUsbTargetPipeFormatRequestForRead and WdfRequestSend.I don’t know how to set timeout.

thank you ,my friends.
stone

Instead of passing NULL for the WDF_REQUEST_SEND_OPTIONS, pass in a valid and initialized pointer

http://msdn.microsoft.com/en-us/library/ff552497(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ff552498(VS.85).aspx

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of zhonghong200@163.com
Sent: Sunday, August 22, 2010 7:15 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] I use wdk’s usbsamp ,but have some question

thank you ,everybody.

I use wdk’s usbsamp example,and modify it for my camera device,and in my camera device ,it use bulk transfer,and now my application usually run well.
(1) but sometime ,it can not receive any data ,and the pipe RSET,who can tell me why?
(2) I want to set a timeout in ReadWriteBulkEndPoints ,how to do it ?
I find WdfusbTargetDeviceSendControlTransferSynchoronouly function ,and it have a parameterto set timeout ,but in usbsamp,it use asynchronous ,and the function is WdfUsbTargetPipeFormatRequestForRead and WdfRequestSend.I don’t know how to set timeout.

thank you ,my friends.
stone


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Doron Holan ,thank you ,I’ll try it

thank you,Doron Holan,I resolve the problem two,but for the first question ,i can not resolve it .

and i debug it ,find in the ReadWriteCompletion fuction, and the pragram run in :

if (!NT_SUCCESS(status)){
//
// Queue a workitem to reset the pipe because the completion could be
// running at DISPATCH_LEVEL.
//
QueuePassiveLevelCallback(WdfIoTargetGetDevice(Target), pipe);
goto End;
}

with status=C00000B5,and the pipe reset, and #define STATUS_IO_TIMEOUT ((NTSTATUS) 0xC00000B5)

so my confuse when the URB request is timeout ,why the transfer size is zero, and in my opinion,when timeout,it may be receive some datas ,and the receive data is less than the transfer size.

is it the bug of WDk ,and who can give me some advice,thank you !

>so my confuse when the URB request is timeout ,why the transfer size is zero, and in my opinion,when timeout,it may be >receive some datas ,and the receive data is less than the transfer size.

is it the bug of WDk ,and who can give me some advice,thank you !

time out means that bus driver don’t have enough time to operate your urb/irp. you won’t get any valid data.

NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

thank you ,chang pei , but i modify the time of the timeout to a very large size, and have the same problem.

I find a question:
for example, my application program use a buffer of 65536 ,and the driver MAX_TRANSFER_SIZE of the package is also 65536 and the device return size is also 65536. at this time ,it usually run well,but when i reduce the size of the device return, such as,modify it to 20000. at this time ,the application can not receive any dadas, the transfer size is zero.

so my question is ,when the device return size is less than the MAX_TRANSFER_SIZE ,it can not get any dadas.

thank you ,every body.

When you cancel an io, which is what the timeout does, there are no guarantees you will get any data. I would not expect for you to get some of the data back, but not all because the transfer is not complete. If you want some fo the data back, perhaps you need to change your device’s protocol to send data back in smaller packets so that you receive data before the timeout.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of zhonghong200@163.com
Sent: Sunday, August 22, 2010 11:19 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] I use wdk’s usbsamp ,but have some question

thank you,Doron Holan,I resolve the problem two,but for the first question ,i can not resolve it .

and i debug it ,find in the ReadWriteCompletion fuction, and the pragram run in :

if (!NT_SUCCESS(status)){
//
// Queue a workitem to reset the pipe because the completion could be
// running at DISPATCH_LEVEL.
//
QueuePassiveLevelCallback(WdfIoTargetGetDevice(Target), pipe);
goto End;
}

with status=C00000B5,and the pipe reset, and #define STATUS_IO_TIMEOUT ((NTSTATUS) 0xC00000B5)

so my confuse when the URB request is timeout ,why the transfer size is zero, and in my opinion,when timeout,it may be receive some datas ,and the receive data is less than the transfer size.

is it the bug of WDk ,and who can give me some advice,thank you !


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

zhonghong200@163.com wrote:

I use wdk’s usbsamp example,and modify it for my camera device,and in my camera device ,it use bulk transfer,and now my application usually run well.
(1) but sometime ,it can not receive any data ,and the pipe RSET,who can tell me why?

No one. You will have to debug this with a USB analyzer.

(2) I want to set a timeout in ReadWriteBulkEndPoints ,how to do it ?
I find WdfusbTargetDeviceSendControlTransferSynchoronouly function ,and it have a parameterto set timeout ,but in usbsamp,it use asynchronous ,and the function is WdfUsbTargetPipeFormatRequestForRead and WdfRequestSend.I don’t know how to set timeout.

You create a WDFTIMER and cancel the request when the timer goes off.


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

> You create a WDFTIMER and cancel the request when the timer goes off.

The WDFREQUEST has its own async timeout functionality built into it. no need to duplicate that on yoru own with a WDFTIMER (and then handle all of the associated races between cancelation, completion, etc)

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Monday, August 23, 2010 10:24 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] I use wdk’s usbsamp ,but have some question

zhonghong200@163.com wrote:

I use wdk’s usbsamp example,and modify it for my camera device,and in my camera device ,it use bulk transfer,and now my application usually run well.
(1) but sometime ,it can not receive any data ,and the pipe RSET,who can tell me why?

No one. You will have to debug this with a USB analyzer.

(2) I want to set a timeout in ReadWriteBulkEndPoints ,how to do it ?
I find WdfusbTargetDeviceSendControlTransferSynchoronouly function ,and it have a parameterto set timeout ,but in usbsamp,it use asynchronous ,and the function is WdfUsbTargetPipeFormatRequestForRead and WdfRequestSend.I don’t know how to set timeout.

You create a WDFTIMER and cancel the request when the timer goes off.


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


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

thank you Tim Roberts and Doron Holan, you are enthusiastic. I’ll ask you a question ,if i want return some data when timeout ,what can i do,?
Doron Holan ,you say change my device’s protocol to send data back in smaller packets so that i can receive data before timeout?

i test it ,but i every time receive packet less than the applciation buffer.

“When you cancel an io, which is what the timeout does, there are no guarantees
you will get any data. I would not expect for you to get some of the data back,
but not all because the transfer is not complete. If you want some fo the data
back, perhaps you need to change your device’s protocol to send data back in
smaller packets so that you receive data before the timeout.”