Problem : Usb Time Outs by SetCommTimeouts

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello NG
I’m developing software for my hardware which is connected via USB to my computer, I already have written the necessary firmware and a mini driver (by Windws2000 DDK) which both works

The Problem
I want to define communication time outs for non-overlapped read and write operations using GetCommTimeouts and SetCommTimeouts but they return with ErrorCode 87 (Invalid Parameters). But I deeply believe that my parameters are correct. I use the same handle that I pass to those two functions to read from and write to my device with no problem
Part of my code is

COMMTIMEOUTS tOuts



HANDLE h = NULL

h = CreateFile(CompleteUsbName, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, OPEN_EXISTING,0, NULL)
if(h == INVALID_HANDLE_VALUE
{
//Debug

if(!GetCommTimeouts(h,&tOuts)

//Debug, GetLastError,â€

if(!SetCommTimeouts(h, &tOuts)

//Debug, GetLastError,â€

I really appreciate any help
Regards, Ebrahi
 
Ebrahim said:
Hello NG,
I'm developing software for my hardware which is connected via USB to my
computer, I already have written the necessary firmware and a mini driver
(by Windws2000 DDK) which both works.

This is not the right group for this sort of question. Try
microsoft.public.win32.programmer.kernel instead.
I want to define communication time outs for non-overlapped read and write
operations using GetCommTimeouts and SetCommTimeouts but they return with
ErrorCode 87 (Invalid Parameters). But I deeply believe that my parameters
are correct. I use the same handle that I pass to those two functions to
read from and write to my device with no problem.

GetCommTimeouts and SetCommTimeouts are specific to the serial port driver.
They're not general-purpose functions which can be applied to any driver.

You can probably get the effect you want by using overlapped I/O and then
doing a WaitForSingleObject on the event object within the OVERLAPPED
structure. WaitForSingleObject takes a millisecond timeout value.

Will
#
 
Back
Top