From: Dee Earley on
On 16/07/2010 08:31, Boris P. wrote:
> There is an application which lists all USB devices. This is almost
> perfect.
> http://omnibus.uni-freiburg.de/~albers/snippets/usbinfo10.zip
>
> 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/DeviceManagerClass.zip
>
> I am really wondering why the USBINFO does not show me the comm port
> although it shows EVERY other information plus lowest level information...

Because they are not directly linked.

The driver talks to the USB device.
The driver creates a virtual serial port.
The driver handles all communications between the two.

Windows does not come into it bar providing the communication between
the app and the serial port, and the driver and the device.

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

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
From: Boris P. on
Yes, okay, you are right...
BOTH devices are using virtual comm ports, as I have found out now.
It's a longer story why I thought that one was a "real" USB port.
I can now sum it up by saying that both devices are using virtual comm
ports.
And I need to find out which virtual comm port each device is connected to.

I understand now that virtual comm port and physical port are not
directly linked, thank you.

But what would be the most sophisticated, safest way to find out which
virtual comm port each device is connected to.

I have a code here that iterates through the services in
HKEY_LOCALE_MACHINE, System\CurrentControlSet\Services\serenum\enum

It returns:

Serial Service 0 : ACPI\PNP0501\1 - COM1
Serial Service 1 : FTDIBUS\VID_0403+PID_FA78+FE000001A\0000 - COM4
Serial Service 2 : FTDIBUS\VID_0403+PID_6001+XTOKXZYWZ\0000 - COM5

FE000001A and XTOKXZYWZ are the serial numbers of the 2 devices, as I
can see by that USBINFO application.

But I feel so damn stupid when I do something like

for i = 0 to ubound(sServices)
if Instr(1, sServices(i), sThisDeviceSerialNumber)>0 then
dim lPort&
lPort = NumberOnly(RegGetValue(HKEY_LOCAL_MACHINE, ParmKey &
SerSrvc(I) & "\Device Parameters", "PortName", REG_SZ, "0"))

This looks REALLY ugly and not safe at all.

From: Dee Earley on
On 16/07/2010 10:35, Boris P. wrote:
> Yes, okay, you are right...
> BOTH devices are using virtual comm ports, as I have found out now.
> It's a longer story why I thought that one was a "real" USB port.
> I can now sum it up by saying that both devices are using virtual comm
> ports.
> And I need to find out which virtual comm port each device is connected to.
>
> I understand now that virtual comm port and physical port are not
> directly linked, thank you.
>
> But what would be the most sophisticated, safest way to find out which
> virtual comm port each device is connected to.
>
> I have a code here that iterates through the services in
> HKEY_LOCALE_MACHINE, System\CurrentControlSet\Services\serenum\enum
>
> It returns:
>
> Serial Service 0 : ACPI\PNP0501\1 - COM1
> Serial Service 1 : FTDIBUS\VID_0403+PID_FA78+FE000001A\0000 - COM4
> Serial Service 2 : FTDIBUS\VID_0403+PID_6001+XTOKXZYWZ\0000 - COM5
>
> FE000001A and XTOKXZYWZ are the serial numbers of the 2 devices, as I
> can see by that USBINFO application.
>
> But I feel so damn stupid when I do something like
>
> for i = 0 to ubound(sServices)
> if Instr(1, sServices(i), sThisDeviceSerialNumber)>0 then
> dim lPort&
> lPort = NumberOnly(RegGetValue(HKEY_LOCAL_MACHINE, ParmKey & SerSrvc(I)
> & "\Device Parameters", "PortName", REG_SZ, "0"))
>
> This looks REALLY ugly and not safe at all.

You either find a way of asking the driver directly, or "guess" based on
what little information you can get.

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

iCode Systems

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