473,320 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 4406
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Bob Greschke | last post by:
We have some equipment that communicates at 57600 baud RS232. The path from the PC is USB to a Phillips USB hub, then off of that a TUSB3410 USB/Serial converter. The driver for the 3410 chip...
0
by: Shashank Date | last post by:
/* C# Gurus, I am trying to use interop marshalling to call SetCommTimeouts win32 API. But I keep getting the "Object reference not set to an instance of an object" error. Can anybody help...
7
by: Michael Chong | last post by:
I wrote a program that communicate with SerialComm. In every 300 milliseconds, my program continuously send & receive data via the serial port once the program starts. My program is once in a...
2
by: Balamurali C | last post by:
Hi All I'm having one problem, since im debuging this last one week I'm not able to do. Problem: In my webage I have two Frames(top & bottom) in the top frame I'm displaying some...
1
by: mithu | last post by:
I have a web service(C#) which involves processing lot of information thru a third party component. I have couple of issues with my web service. Issue 1: My web service calls a third party...
7
by: Robbert van Geldrop | last post by:
Hello, I have a problem in a C# client that consumes a webservice which is wrapped by WSE 2.0 sp3: The WebService works fine but very rarely my client comes in a state where every call to the...
2
by: Richard | last post by:
Hello all, I am looking into issues with time-outs on a website. These appear to happen in a random way for some users. This is one example: Fatal error: Maximum execution time of 60 seconds...
5
by: buggex | last post by:
Hey! I have runned into a strange problem, when trying to setup a serial port. The code I use to open the port: // Opening the Port "COM1" hComm = CreateFile( "COM1", GENERIC_READ | GENERIC_WRITE,...
5
by: pankajs | last post by:
hello ! i m reading a wav file by int b=ins.read(); and writing b on other wav file by outs.write(b); in a loop until b==-1 where InputStream ins = new FileInputStream("C:/audio.wav"); ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.