472,096 Members | 1,198 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,096 software developers and data experts.

Problem : Usb Time Outs by SetCommTimeouts

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
Nov 17 '05 #1
2 4338
"Ebrahim" <an*******@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com...
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.
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.

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
#
Nov 17 '05 #2
Thank you, Will.
Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Bob Greschke | last post: by
reply views Thread by Shashank Date | last post: by
7 posts views Thread by Michael Chong | last post: by
2 posts views Thread by Balamurali C | last post: by
7 posts views Thread by Robbert van Geldrop | last post: by
5 posts views Thread by buggex | last post: by
5 posts views Thread by pankajs | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.