Hi freaks,

I'm looking for a way to solve the following problem:

I've a pc with several usb hubs attached to. To these hubs there are
usb devices attached in turn (typical 4 usb-serial converter and a
memery stick). Due to the undefined connection sequence I'm not able to
predict which COM port is located to which usb hub - but my software
have to know it for sure.

I've been able to find a way to identify all to the system attached usb
devices (.NET framework: System.Management.PropertyDataCollection). But
further more I have to know, which usb device is attached to which usb
hub. Is there something like a path which shows me the actual physical
tree structure of hubs and devices and their assigned com ports? (I
know: It is a bus system ;-) )

\\pc\usb_01\hub_02\device_01->(ComPort 05)
\device_02->(ComPort 02)
\device_03->(ComPort 03)
\device_04->(ComPort 04)
\\pc\usb_03\hub_01\device_01->(ComPort 01)
...

Where can I get these information (registry) an how can I obtain this
information by software (e.g. C#)

Thanks in advance!
Mario

Re: Identify attached devices to an usb hub by DriverStarter

DriverStarter
Tue Aug 09 14:02:43 CDT 2005

I one did it (USB printer) by checking registry.



<Mario.Becker@gmx.com> wrote in message
news:1123599665.478855.88510@g44g2000cwa.googlegroups.com...
> Hi freaks,
>
> I'm looking for a way to solve the following problem:
>
> I've a pc with several usb hubs attached to. To these hubs there are
> usb devices attached in turn (typical 4 usb-serial converter and a
> memery stick). Due to the undefined connection sequence I'm not able to
> predict which COM port is located to which usb hub - but my software
> have to know it for sure.
>
> I've been able to find a way to identify all to the system attached usb
> devices (.NET framework: System.Management.PropertyDataCollection). But
> further more I have to know, which usb device is attached to which usb
> hub. Is there something like a path which shows me the actual physical
> tree structure of hubs and devices and their assigned com ports? (I
> know: It is a bus system ;-) )
>
> \\pc\usb_01\hub_02\device_01->(ComPort 05)
> \device_02->(ComPort 02)
> \device_03->(ComPort 03)
> \device_04->(ComPort 04)
> \\pc\usb_03\hub_01\device_01->(ComPort 01)
> ...
>
> Where can I get these information (registry) an how can I obtain this
> information by software (e.g. C#)
>
> Thanks in advance!
> Mario
>



Re: Identify attached devices to an usb hub by Mark

Mark
Wed Aug 10 05:52:13 CDT 2005

Mario.Becker@gmx.com wrote:
> Hi freaks,
>
> I'm looking for a way to solve the following problem:
>
> I've a pc with several usb hubs attached to. To these hubs there are
> usb devices attached in turn (typical 4 usb-serial converter and a
> memery stick). Due to the undefined connection sequence I'm not able to
> predict which COM port is located to which usb hub - but my software
> have to know it for sure.
>
> I've been able to find a way to identify all to the system attached usb
> devices (.NET framework: System.Management.PropertyDataCollection). But
> further more I have to know, which usb device is attached to which usb
> hub. Is there something like a path which shows me the actual physical
> tree structure of hubs and devices and their assigned com ports? (I
> know: It is a bus system ;-) )
>
> \\pc\usb_01\hub_02\device_01->(ComPort 05)
> \device_02->(ComPort 02)
> \device_03->(ComPort 03)
> \device_04->(ComPort 04)
> \\pc\usb_03\hub_01\device_01->(ComPort 01)
> ...
>
> Where can I get these information (registry) an how can I obtain this
> information by software (e.g. C#)
>
> Thanks in advance!
> Mario
>
Look at the usbview sample in the ddk.

--

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

Re: Identify attached devices to an usb hub by heinz

heinz
Wed Aug 10 08:45:45 CDT 2005

I think you can accomplish everything you are asking for using the
setup api's (i.e. SetupDixxx functions).


Re: Identify attached devices to an usb hub by DriverStarter

DriverStarter
Wed Aug 10 09:22:40 CDT 2005

to my understanding, That ID is from bus Pnp, nothing setupDixx can do,


Correct me if I am wrong,


"heinz" <heinz_baer@my-deja.com> wrote in message
news:1123681545.214623.17550@f14g2000cwb.googlegroups.com...
>I think you can accomplish everything you are asking for using the
> setup api's (i.e. SetupDixxx functions).
>



Re: Identify attached devices to an usb hub by Bill

Bill
Wed Aug 10 10:45:30 CDT 2005

You are wrong. You are not trying to set the ID, just read it right? Thus
the SetupDi functions can help you with this. Follow Mark Roddy's advice
and check out the UsbView sample in the DDK. This very likely already does
exactly what you want with source to look at.

Bill M.

"DriverStarter" <driverstarter@newsgroup.nospam> wrote in message
news:eLDe6bbnFHA.1464@TK2MSFTNGP14.phx.gbl...
> to my understanding, That ID is from bus Pnp, nothing setupDixx can do,
>
>
> Correct me if I am wrong,
>
>
> "heinz" <heinz_baer@my-deja.com> wrote in message
> news:1123681545.214623.17550@f14g2000cwb.googlegroups.com...
>>I think you can accomplish everything you are asking for using the
>> setup api's (i.e. SetupDixxx functions).
>>
>
>



Re: Identify attached devices to an usb hub by DriverStarter

DriverStarter
Wed Aug 10 11:30:35 CDT 2005

My ID means COM port ID Becker mentioned.

That COM port ID is dynamically changed as USB devices plug in in different
orders. it's not depend on the device.


"Bill McKenzie" <bill_mckenzie@csr.com> wrote in message
news:uXDRSKcnFHA.3552@TK2MSFTNGP10.phx.gbl...
> You are wrong. You are not trying to set the ID, just read it right?
> Thus the SetupDi functions can help you with this. Follow Mark Roddy's
> advice and check out the UsbView sample in the DDK. This very likely
> already does exactly what you want with source to look at.
>
> Bill M.
>
> "DriverStarter" <driverstarter@newsgroup.nospam> wrote in message
> news:eLDe6bbnFHA.1464@TK2MSFTNGP14.phx.gbl...
>> to my understanding, That ID is from bus Pnp, nothing setupDixx can do,
>>
>>
>> Correct me if I am wrong,
>>
>>
>> "heinz" <heinz_baer@my-deja.com> wrote in message
>> news:1123681545.214623.17550@f14g2000cwb.googlegroups.com...
>>>I think you can accomplish everything you are asking for using the
>>> setup api's (i.e. SetupDixxx functions).
>>>
>>
>>
>
>



Re: Identify attached devices to an usb hub by Bill

Bill
Wed Aug 10 14:21:30 CDT 2005

Ah, yes the COM port IDs are assigned dynamically by the class installer DLL
msports.dll.

You can probably use SetupDi calls to get the hardware IDs for these ports
and see which bus enumerated them. This might give you the relationship you
are looking for straight out. You can try looking at one of the ports in
DeviceManager and seeing what the hardware IDs look like and see if they
convey enough information for you. DeviceManager on XP SP2 has a details
property page with hardware ID information. On previous OS versions you
have to explicitly enable this property page from the registry. How this is
done I don't recall exactly, but you can probably search this newsgroup and
find out, I know it has been discussed before.

Bill M.

"DriverStarter" <driverstarter@newsgroup.nospam> wrote in message
news:u6cwYjcnFHA.2904@tk2msftngp13.phx.gbl...
> My ID means COM port ID Becker mentioned.
>
> That COM port ID is dynamically changed as USB devices plug in in
> different orders. it's not depend on the device.
>
>
> "Bill McKenzie" <bill_mckenzie@csr.com> wrote in message
> news:uXDRSKcnFHA.3552@TK2MSFTNGP10.phx.gbl...
>> You are wrong. You are not trying to set the ID, just read it right?
>> Thus the SetupDi functions can help you with this. Follow Mark Roddy's
>> advice and check out the UsbView sample in the DDK. This very likely
>> already does exactly what you want with source to look at.
>>
>> Bill M.
>>
>> "DriverStarter" <driverstarter@newsgroup.nospam> wrote in message
>> news:eLDe6bbnFHA.1464@TK2MSFTNGP14.phx.gbl...
>>> to my understanding, That ID is from bus Pnp, nothing setupDixx can do,
>>>
>>>
>>> Correct me if I am wrong,
>>>
>>>
>>> "heinz" <heinz_baer@my-deja.com> wrote in message
>>> news:1123681545.214623.17550@f14g2000cwb.googlegroups.com...
>>>>I think you can accomplish everything you are asking for using the
>>>> setup api's (i.e. SetupDixxx functions).
>>>>
>>>
>>>
>>
>>
>
>



Re: Identify attached devices to an usb hub by DriverStarter

DriverStarter
Wed Aug 10 16:28:44 CDT 2005

That's a good detailed description.


The undocumented part is, how to find a COM ID that has a specified device
symbolic name.


"Bill McKenzie" <bm01_REMOVE_@csr.com> wrote in message
news:%23Y4i%23CenFHA.1468@TK2MSFTNGP12.phx.gbl...
> Ah, yes the COM port IDs are assigned dynamically by the class installer
> DLL msports.dll.
>
> You can probably use SetupDi calls to get the hardware IDs for these ports
> and see which bus enumerated them. This might give you the relationship
> you are looking for straight out. You can try looking at one of the ports
> in DeviceManager and seeing what the hardware IDs look like and see if
> they convey enough information for you. DeviceManager on XP SP2 has a
> details property page with hardware ID information. On previous OS
> versions you have to explicitly enable this property page from the
> registry. How this is done I don't recall exactly, but you can probably
> search this newsgroup and find out, I know it has been discussed before.
>
> Bill M.
>
> "DriverStarter" <driverstarter@newsgroup.nospam> wrote in message
> news:u6cwYjcnFHA.2904@tk2msftngp13.phx.gbl...
>> My ID means COM port ID Becker mentioned.
>>
>> That COM port ID is dynamically changed as USB devices plug in in
>> different orders. it's not depend on the device.
>>
>>
>> "Bill McKenzie" <bill_mckenzie@csr.com> wrote in message
>> news:uXDRSKcnFHA.3552@TK2MSFTNGP10.phx.gbl...
>>> You are wrong. You are not trying to set the ID, just read it right?
>>> Thus the SetupDi functions can help you with this. Follow Mark Roddy's
>>> advice and check out the UsbView sample in the DDK. This very likely
>>> already does exactly what you want with source to look at.
>>>
>>> Bill M.
>>>
>>> "DriverStarter" <driverstarter@newsgroup.nospam> wrote in message
>>> news:eLDe6bbnFHA.1464@TK2MSFTNGP14.phx.gbl...
>>>> to my understanding, That ID is from bus Pnp, nothing setupDixx can do,
>>>>
>>>>
>>>> Correct me if I am wrong,
>>>>
>>>>
>>>> "heinz" <heinz_baer@my-deja.com> wrote in message
>>>> news:1123681545.214623.17550@f14g2000cwb.googlegroups.com...
>>>>>I think you can accomplish everything you are asking for using the
>>>>> setup api's (i.e. SetupDixxx functions).
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: Identify attached devices to an usb hub by Bill

Bill
Thu Aug 11 00:48:23 CDT 2005

You asked:

>further more I have to know, which usb device is attached to which usb
>hub

This you can find just as the USBView DDK sample does.

Further you asked:

>and their assigned com ports
>\\pc\usb_01\hub_02\device_01->(ComPort 05)
> \device_02->(ComPort 02)
> \device_03->(ComPort 03)
> \device_04->(ComPort 04)

And I am suggesting that you look at the hardware IDs of these COM ports and
that will likely tell you what device they belong too.

For instance, on my system I have a virtual COM port named COM6. I look at
the device instance ID for COM6 in DeviceManager and it is
BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}\7&C52E2AD&0&000000000000_00000002

I can tell from this ID that this COM port was created by the bluetooth
stack on my machine. Now in your case this ID may or may not lead you to
which device your COM port is connected. At anyrate, you can probably look
at devices by connection in device manager and see there what device it is
connected to. Anything you can do in DeviceManager you can do in your own
user-mode application. Check out the DDK Devcon sample as this is
essentially a command-line version of DeviceManager with source.

Did I miss something you were asking?

Bill M.

"DriverStarter" <driverstarter@newsgroup.nospam> wrote in message
news:eWTb$JfnFHA.1464@TK2MSFTNGP14.phx.gbl...
> That's a good detailed description.
>
>
> The undocumented part is, how to find a COM ID that has a specified device
> symbolic name.
>
>
> "Bill McKenzie" <bm01_REMOVE_@csr.com> wrote in message
> news:%23Y4i%23CenFHA.1468@TK2MSFTNGP12.phx.gbl...
>> Ah, yes the COM port IDs are assigned dynamically by the class installer
>> DLL msports.dll.
>>
>> You can probably use SetupDi calls to get the hardware IDs for these
>> ports and see which bus enumerated them. This might give you the
>> relationship you are looking for straight out. You can try looking at
>> one of the ports in DeviceManager and seeing what the hardware IDs look
>> like and see if they convey enough information for you. DeviceManager on
>> XP SP2 has a details property page with hardware ID information. On
>> previous OS versions you have to explicitly enable this property page
>> from the registry. How this is done I don't recall exactly, but you can
>> probably search this newsgroup and find out, I know it has been discussed
>> before.
>>
>> Bill M.
>>
>> "DriverStarter" <driverstarter@newsgroup.nospam> wrote in message
>> news:u6cwYjcnFHA.2904@tk2msftngp13.phx.gbl...
>>> My ID means COM port ID Becker mentioned.
>>>
>>> That COM port ID is dynamically changed as USB devices plug in in
>>> different orders. it's not depend on the device.
>>>
>>>
>>> "Bill McKenzie" <bill_mckenzie@csr.com> wrote in message
>>> news:uXDRSKcnFHA.3552@TK2MSFTNGP10.phx.gbl...
>>>> You are wrong. You are not trying to set the ID, just read it right?
>>>> Thus the SetupDi functions can help you with this. Follow Mark Roddy's
>>>> advice and check out the UsbView sample in the DDK. This very likely
>>>> already does exactly what you want with source to look at.
>>>>
>>>> Bill M.
>>>>
>>>> "DriverStarter" <driverstarter@newsgroup.nospam> wrote in message
>>>> news:eLDe6bbnFHA.1464@TK2MSFTNGP14.phx.gbl...
>>>>> to my understanding, That ID is from bus Pnp, nothing setupDixx can
>>>>> do,
>>>>>
>>>>>
>>>>> Correct me if I am wrong,
>>>>>
>>>>>
>>>>> "heinz" <heinz_baer@my-deja.com> wrote in message
>>>>> news:1123681545.214623.17550@f14g2000cwb.googlegroups.com...
>>>>>>I think you can accomplish everything you are asking for using the
>>>>>> setup api's (i.e. SetupDixxx functions).
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: Identify attached devices to an usb hub by DriverStarter

DriverStarter
Fri Aug 12 11:28:33 CDT 2005

Good comments,


it seems more valid than just checking registries.



"Bill McKenzie" <bm01_REMOVE_@csr.com> wrote in message
news:ewdtRhjnFHA.3608@TK2MSFTNGP15.phx.gbl...
> You asked:
>
>>further more I have to know, which usb device is attached to which usb
>>hub
>
> This you can find just as the USBView DDK sample does.
>
> Further you asked:
>
>>and their assigned com ports
>>\\pc\usb_01\hub_02\device_01->(ComPort 05)
>> \device_02->(ComPort 02)
>> \device_03->(ComPort 03)
>> \device_04->(ComPort 04)
>
> And I am suggesting that you look at the hardware IDs of these COM ports
> and that will likely tell you what device they belong too.
>
> For instance, on my system I have a virtual COM port named COM6. I look
> at the device instance ID for COM6 in DeviceManager and it is
> BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}\7&C52E2AD&0&000000000000_00000002
>
> I can tell from this ID that this COM port was created by the bluetooth
> stack on my machine. Now in your case this ID may or may not lead you to
> which device your COM port is connected. At anyrate, you can probably
> look at devices by connection in device manager and see there what device
> it is connected to. Anything you can do in DeviceManager you can do in
> your own user-mode application. Check out the DDK Devcon sample as this
> is essentially a command-line version of DeviceManager with source.
>
> Did I miss something you were asking?
>
> Bill M.
>
> "DriverStarter" <driverstarter@newsgroup.nospam> wrote in message
> news:eWTb$JfnFHA.1464@TK2MSFTNGP14.phx.gbl...
>> That's a good detailed description.
>>
>>
>> The undocumented part is, how to find a COM ID that has a specified
>> device symbolic name.
>>
>>
>> "Bill McKenzie" <bm01_REMOVE_@csr.com> wrote in message
>> news:%23Y4i%23CenFHA.1468@TK2MSFTNGP12.phx.gbl...
>>> Ah, yes the COM port IDs are assigned dynamically by the class installer
>>> DLL msports.dll.
>>>
>>> You can probably use SetupDi calls to get the hardware IDs for these
>>> ports and see which bus enumerated them. This might give you the
>>> relationship you are looking for straight out. You can try looking at
>>> one of the ports in DeviceManager and seeing what the hardware IDs look
>>> like and see if they convey enough information for you. DeviceManager
>>> on XP SP2 has a details property page with hardware ID information. On
>>> previous OS versions you have to explicitly enable this property page
>>> from the registry. How this is done I don't recall exactly, but you can
>>> probably search this newsgroup and find out, I know it has been
>>> discussed before.
>>>
>>> Bill M.
>>>
>>> "DriverStarter" <driverstarter@newsgroup.nospam> wrote in message
>>> news:u6cwYjcnFHA.2904@tk2msftngp13.phx.gbl...
>>>> My ID means COM port ID Becker mentioned.
>>>>
>>>> That COM port ID is dynamically changed as USB devices plug in in
>>>> different orders. it's not depend on the device.
>>>>
>>>>
>>>> "Bill McKenzie" <bill_mckenzie@csr.com> wrote in message
>>>> news:uXDRSKcnFHA.3552@TK2MSFTNGP10.phx.gbl...
>>>>> You are wrong. You are not trying to set the ID, just read it right?
>>>>> Thus the SetupDi functions can help you with this. Follow Mark
>>>>> Roddy's advice and check out the UsbView sample in the DDK. This very
>>>>> likely already does exactly what you want with source to look at.
>>>>>
>>>>> Bill M.
>>>>>
>>>>> "DriverStarter" <driverstarter@newsgroup.nospam> wrote in message
>>>>> news:eLDe6bbnFHA.1464@TK2MSFTNGP14.phx.gbl...
>>>>>> to my understanding, That ID is from bus Pnp, nothing setupDixx can
>>>>>> do,
>>>>>>
>>>>>>
>>>>>> Correct me if I am wrong,
>>>>>>
>>>>>>
>>>>>> "heinz" <heinz_baer@my-deja.com> wrote in message
>>>>>> news:1123681545.214623.17550@f14g2000cwb.googlegroups.com...
>>>>>>>I think you can accomplish everything you are asking for using the
>>>>>>> setup api's (i.e. SetupDixxx functions).
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>