I developed a USB driver based on the UMDF FX2 sample driver. It seems to work ok but I have a couple of questions. I’m using Version 1.5.
When I perform a ReadFile(…) and specify an overlapped structure, I expect this read to pend until data is available or it is cancelled. Instead in the read/write completion routine, I receive a “Semaphore Timeout”. Is this correct behavior?
What is the maximum number of bytes I can attempt to read using ReadFile(…)? When I try to read 8MB, the call doesn’t make it down to my UMDF driver. Instead the function fails with “Not enough quota available”.
Any help or suggestions would be greatly appreciated.
On question #1 I’m not sure I understand who is performing the ReadFile()? The application? Your driver? If the application does the read reach your driver? Does the error you see come from the USB layer? Can you check the last error code in your application (!gle in windbg will print out both the last Win32 and NT error values for the thread - the latter is often helpful as there isn’t a 1:1 mapping between Win32 error codes and NT error codes)
I developed a USB driver based on the UMDF FX2 sample driver. It seems to work ok but I have a couple of questions. I’m using Version 1.5.
When I perform a ReadFile(…) and specify an overlapped structure, I expect this read to pend until data is available or it is cancelled. Instead in the read/write completion routine, I receive a “Semaphore Timeout”. Is this correct behavior?
What is the maximum number of bytes I can attempt to read using ReadFile(…)? When I try to read 8MB, the call doesn’t make it down to my UMDF driver. Instead the function fails with “Not enough quota available”.
Any help or suggestions would be greatly appreciated.
wrote in message news:xxxxx@ntdev… >I developed a USB driver based on the UMDF FX2 sample driver. It seems to >work ok but I have a couple of questions. I’m using Version 1.5. > > 1) When I perform a ReadFile(…) and specify an overlapped structure, I > expect this read to pend until data is available or it is cancelled. > Instead in the read/write completion routine, I receive a “Semaphore > Timeout”. Is this correct behavior? > > 2) What is the maximum number of bytes I can attempt to read using > ReadFile(…)? When I try to read 8MB, the call doesn’t make it down to > my UMDF driver. Instead the function fails with “Not enough quota > available”. > > Any help or suggestions would be greatly appreciated. > > Thanks, > > Dave >
Peter: Sorry I didn’t state my question clearly. I’ll try to clear up the confusion now. The application performs the ReadFile(). This goes to the driver and is handled by the OnRead() from the ReadWriteQueue. The completion routine for the queue, OnCompletion(), executes and the call to GetCompletionStatus() returns the error “Semaphore Timeout”. I wouldn’t expect the completion routine to execute until data has returned for the pended Read. The variable pWdfRequest that is passed to the completion routine, matches the pWdfRequest from OnRead(). I’ve also made sure that I didn’t have any additional reads pended while I’m trying to solve this problem.
Thanks for your help so far. Hopefully I was able to provide you with enough additional information to make my problem less confusing.
On UMDF versions <= 1.7, there is a restriction that the buffer size must
not be greater than 4MB on Vista. On XP and Server 2003, the restriction is
not there.
For the next release of UMDF (after 1.7), the restriction is being removed
even for Windows Vista.
wrote in message news:xxxxx@ntdev… > Abishek: This running under 64-bit Vista. > > Peter: Sorry I didn’t state my question clearly. I’ll try to clear up > the confusion now. The application performs the ReadFile(). This goes to > the driver and is handled by the OnRead() from the ReadWriteQueue. The > completion routine for the queue, OnCompletion(), executes and the call to > GetCompletionStatus() returns the error “Semaphore Timeout”. I wouldn’t > expect the completion routine to execute until data has returned for the > pended Read. The variable pWdfRequest that is passed to the completion > routine, matches the pWdfRequest from OnRead(). I’ve also made sure that > I didn’t have any additional reads pended while I’m trying to solve this > problem. > Thanks for your help so far. Hopefully I was able to provide you with > enough additional information to make my problem less confusing. > > Dave > >
On UMDF versions <= 1.7, there is a restriction that the buffer size must
not be greater than 4MB on Vista. On XP and Server 2003, the restriction is
not there.
For the next release of UMDF (after 1.7), the restriction is being removed
even for Windows Vista.
wrote in message news:xxxxx@ntdev… > Abishek: This running under 64-bit Vista. > > Peter: Sorry I didn’t state my question clearly. I’ll try to clear up > the confusion now. The application performs the ReadFile(). This goes to > the driver and is handled by the OnRead() from the ReadWriteQueue. The > completion routine for the queue, OnCompletion(), executes and the call to > GetCompletionStatus() returns the error “Semaphore Timeout”. I wouldn’t > expect the completion routine to execute until data has returned for the > pended Read. The variable pWdfRequest that is passed to the completion > routine, matches the pWdfRequest from OnRead(). I’ve also made sure that > I didn’t have any additional reads pended while I’m trying to solve this > problem. > Thanks for your help so far. Hopefully I was able to provide you with > enough additional information to make my problem less confusing. > > Dave > >
Regarding your problem of ReadFile returning semaphore timeout:
Are you issuing read to a bulk pipe?
The UMDF fx2 sample sets a timeout on bulk pipes. This is only for illustration purposes. You should remove that in your driver if such timeout doesn’t apply to you.
Namely, take out CMyDevice::ConfigurePipes function in your driver. ConfigurePipes calls m_pIUsbInputPipe->SetPipePolicy(PIPE_TRANSFER_TIMEOUT, …) and m_pIUsbOutputPipe->SetPipePolicy(PIPE_TRANSFER_TIMEOUT, …).
Sample doesn’t set any timeout for interrupt pipe since that is the one used for pending read indefinitely to receive device events.
Thanks for everyones responses. I wasn’t aware of the Vista 4MB limitation and I overlooked the timeout being set for bulk pipes. Any idea how long until a version > 1.7 will be released? It would be helpful to be able to transfer data in chunks greater than 4MB without having to break up the reads.