[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Boris P.

7/14/2010 1:37:00 PM

Just a question:

Let's say I have 2 USB devices connected to the computer, would MSComm
allow me only connecting to one at a time?
That's what how it appears to me, but I am not sure if I didn't make any
mistake.
If somebody could just confirm that only 1 at a time is possible, it
would already give me a push in the right direction to think.
14 Answers

David Kerber

7/14/2010 2:25:00 PM

0

In article <uzZ$9m1ILHA.3732@TK2MSFTNGP02.phx.gbl>,
bpnotvalid@nospamhotmail.com says...
>
> Just a question:
>
> Let's say I have 2 USB devices connected to the computer, would MSComm
> allow me only connecting to one at a time?
> That's what how it appears to me, but I am not sure if I didn't make any
> mistake.
> If somebody could just confirm that only 1 at a time is possible, it
> would already give me a push in the right direction to think.

That would depend on the device and its drivers. If you have RS-232
devices through USB-to-232 converters, you can hit all of them since
they just show up as additional comm ports (comm5, comm6, etc).

D

Henning

7/14/2010 2:26:00 PM

0


"Boris P." <bpnotvalid@nospamhotmail.com> skrev i meddelandet
news:uzZ$9m1ILHA.3732@TK2MSFTNGP02.phx.gbl...
> Just a question:
>
> Let's say I have 2 USB devices connected to the computer, would MSComm
> allow me only connecting to one at a time?
> That's what how it appears to me, but I am not sure if I didn't make any
> mistake.
> If somebody could just confirm that only 1 at a time is possible, it would
> already give me a push in the right direction to think.

You have to add a MSComm control for each Comport.

/Henning


Boris P.

7/14/2010 5:08:00 PM

0

The two controls-thing is interesting.

Yes, one goes by a USB-to-232 converter, and the other one is called
directly by APIs.
When I attach only one of them, everything goes fine.

But when I attach both, I get either

1) An error in the comm-control, saying that the port is already open,
and when I try to send data, it tells me that the port has to be opened...

2) A data when I try to send that data by the APIs, I get an error.

Is that normal?

Boris P.

7/14/2010 5:26:00 PM

0

Sorry, misspelt:

> The two controls-thing is interesting.
>
> Yes, one goes by a USB-to-232 converter, and the other one is called
> directly by APIs.
> When I attach only one of them, everything goes fine.
>
> But when I attach both, I get either
>
> 1) An error in the comm-control, saying that the port is already open,
> and when I try to send data, it tells me that the port has to be opened to send data (but of course I cannot open it...)...
>
> 2) An error return code when I try to send data by the API


Dee Earley

7/15/2010 8:43:00 AM

0

On 14/07/2010 18:07, Boris P. wrote:
> The two controls-thing is interesting.
>
> Yes, one goes by a USB-to-232 converter, and the other one is called
> directly by APIs.
> When I attach only one of them, everything goes fine.
>
> But when I attach both, I get either
>
> 1) An error in the comm-control, saying that the port is already open,
> and when I try to send data, it tells me that the port has to be opened...
>
> 2) A data when I try to send that data by the APIs, I get an error.
>
> Is that normal?

You are actually specifying a different COM port?
Does it work (talking to the correct device) one at a time?

--
Dee Earley (dee.earley@icode.co.uk)
i-Catcher Development Team

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Boris P.

7/15/2010 2:42:00 PM

0

When talking to the one device using the MSComm control, I have to
define the port, yes. And it wouldn't work if I selected the wrong port.

When talking to the other device, I cannot specify a (virtual) port, I
can only say that I want to use the USB port.

Yes, when only one of the two devices is attached, everything runs smoothly.


Dick Grier

7/15/2010 4:22:00 PM

0

No.

However, I don't know exactly what you are doing. Are these USB serial port
adapters or devices? If so, each will have a port number assigned by the
associated driver. You would use a separate instance of MSComm to access
each of these devices. You certainly can access multiple devices at the
same time.

I have lots of example code in my book (see below) that might be helpful.
However, you also may want to provide more information (I'll look lower in
the tree to see if you have more to say).

Dick

--
Richard Grier, Consultant, Hard & Software 12962 West Louisiana Avenue
Lakewood, CO 80228 303-986-2179 (voice) Homepage: www.hardandsoftware.net
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004, Revised July
2006.

Dick Grier

7/15/2010 4:26:00 PM

0

I'd need more information. What APIs are you using?

From what you say, my best guess is that the "second" USB device (the one
that you are accessing via some sort of API) is doing something
unconventional. By rules of USB design, two separate USB devices do not
share resources, so using them independently is normal. If your second
device interferes with the operation of the first, then I'd say the fault
lies in the device driver for the second.

Dick
--
Richard Grier, Consultant, Hard & Software 12962 West Louisiana Avenue
Lakewood, CO 80228 303-986-2179 (voice) Homepage: www.hardandsoftware.net
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004, Revised July
2006.

Boris P.

7/16/2010 6:17:00 AM

0

I have discovered one problem:

I am not able to retrieve the VIRTUAL port of the one device which is
talking via the converter and the MSCOMM control.

Right now, I can only see to which physical USB port it is connected.
I am then trying to open each port, trying to send my data in order to
get a reply from the device. Maybe that is the problem... I will have to
figure that out first.

Does anybody know any code how to retrieve the VIRTUAL comm port, and
not only the physical port to which a device is connected? So far I have
not been able to find one.

Boris P.

7/16/2010 7:31:00 AM

0


There is an application which lists all USB devices. This is almost perfect.
http://omnibus.uni-freiburg.de/~albers/snippets/usb...

The only problem is that I am not able to find out which (I avoid the
word "virtual" now because I am not sure if it's correct) comm port.

There is another application which does show me the comm port correctly:
http://vbcity.com/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.65.10.62/DeviceManage...

I am really wondering why the USBINFO does not show me the comm port
although it shows EVERY other information plus lowest level information...