469,332 Members | 7,006 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,332 developers. It's quick & easy.

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 4201
"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
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.