Binding DeviceId to Usb Port

Hi,
I’ve written a driver for a usb device which provides three virtual serial
ports. In my implementation I have two drivers: the driver for my usb
device, which acts as a bus, and a driver for my virtual serial devices.

I would like the same 3 com ports to be assigned to any device attached to a
particular usb port, regardless of which physical device is plugged in.

In response to a IRP_MN_QUERY_ID BusQueryDeviceID request, I would like my
PDO to return an id string uniquely identifying which usb port my device is
connected to. Currently, I use the Address field from the
DEVICE_CAPABILITIES. However, this isn’t unique across all hubs.

I’ve tried looking through the DDK, searching through Google, various user
groups, and www.usb.org, but am not quite sure how to phrase the search
request.

Does anybody know what I should be using? I need a solution that works for
both W2K and XP.

Thanks in advance,
Linda

Give your USB device a serial number, then no matter what port you are
plugged into (assuming it is on the same controller), your 3 children
will always have the same devnode.

D

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Linda Marcellus
Sent: Wednesday, September 10, 2003 10:23 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Binding DeviceId to Usb Port

Hi,
I’ve written a driver for a usb device which provides three virtual
serial
ports. In my implementation I have two drivers: the driver for my usb
device, which acts as a bus, and a driver for my virtual serial devices.

I would like the same 3 com ports to be assigned to any device attached
to a
particular usb port, regardless of which physical device is plugged in.

In response to a IRP_MN_QUERY_ID BusQueryDeviceID request, I would like
my
PDO to return an id string uniquely identifying which usb port my device
is
connected to. Currently, I use the Address field from the
DEVICE_CAPABILITIES. However, this isn’t unique across all hubs.

I’ve tried looking through the DDK, searching through Google, various
user
groups, and www.usb.org, but am not quite sure how to phrase the search
request.

Does anybody know what I should be using? I need a solution that works
for
both W2K and XP.

Thanks in advance,
Linda


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Lets see if I understand you correctly.

If a PC has 4 USB ports and you plug your device into the 1st port you want
the virtual serial ports to be named COM1, COM2 & COM3.

If your device is plugged into the 2nd you want the virtual serial ports to
be named COM4, COM5 & COM6.

Now if a 6 port hub is plugged into the 3rd port and your device is plugged
into the hubs 6th port then ???

It seems to me that you need to know the name of “parent port” your device
is attached to then base the name off of that.

Larry

PS If your USB device DOES NOT provide a serial number via the device
descriptor than the symbolic name generated by Windows will contain the
parent port ID rather than serial # information.

-----Original Message-----
From: Linda Marcellus [mailto:xxxxx@novatel.ca]
Sent: Wednesday, September 10, 2003 1:23 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Binding DeviceId to Usb Port

Hi,
I’ve written a driver for a usb device which provides three virtual serial
ports. In my implementation I have two drivers: the driver for my usb
device, which acts as a bus, and a driver for my virtual serial devices.

I would like the same 3 com ports to be assigned to any device attached to a
particular usb port, regardless of which physical device is plugged in.

In response to a IRP_MN_QUERY_ID BusQueryDeviceID request, I would like my
PDO to return an id string uniquely identifying which usb port my device is
connected to. Currently, I use the Address field from the
DEVICE_CAPABILITIES. However, this isn’t unique across all hubs.

I’ve tried looking through the DDK, searching through Google, various user
groups, and www.usb.org, but am not quite sure how to phrase the search
request.

Does anybody know what I should be using? I need a solution that works for
both W2K and XP.

Thanks in advance,
Linda


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@diebold.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

That’s correct. In your example, the com ports for the device plugged into
the 6th port of the hub plugged into the 3rd port of my PC would get
assigned COM7, COM8, and COM9.

My device does provide a serial number in the device descriptors.

Through trial and error, I’ve seen that the
DevicePropertyPhysicalDeviceObjectName is of the form \Device\USBPDO-n where
n seems to be unique to the hub. Maybe I could use that ‘n’ value and set
my device id string to something like UsbPort-nm, where n is the hub number
and m is the port number (address from the DEVICE_CAPABILITIES).

But will the n value be the same?

Or maybe I should use the PDO’s DevicePropertyAddress so that my device id
is something like UsbPort-E4FC3328_m.

I’m kind of leaning toward the latter.

Linda

“Harmon, Larry (CT)” wrote in message
news:xxxxx@ntdev…
>
> Lets see if I understand you correctly.
>
> If a PC has 4 USB ports and you plug your device into the 1st port you
want
> the virtual serial ports to be named COM1, COM2 & COM3.
>
> If your device is plugged into the 2nd you want the virtual serial ports
to
> be named COM4, COM5 & COM6.
>
> Now if a 6 port hub is plugged into the 3rd port and your device is
plugged
> into the hubs 6th port then ???
>
> It seems to me that you need to know the name of “parent port” your device
> is attached to then base the name off of that.
>
> Larry
>
> PS If your USB device DOES NOT provide a serial number via the device
> descriptor than the symbolic name generated by Windows will contain the
> parent port ID rather than serial # information.
>
> -----Original Message-----
> From: Linda Marcellus [mailto:xxxxx@novatel.ca]
> Sent: Wednesday, September 10, 2003 1:23 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Binding DeviceId to Usb Port
>
>
> Hi,
> I’ve written a driver for a usb device which provides three virtual serial
> ports. In my implementation I have two drivers: the driver for my usb
> device, which acts as a bus, and a driver for my virtual serial devices.
>
> I would like the same 3 com ports to be assigned to any device attached to
a
> particular usb port, regardless of which physical device is plugged in.
>
> In response to a IRP_MN_QUERY_ID BusQueryDeviceID request, I would like my
> PDO to return an id string uniquely identifying which usb port my device
is
> connected to. Currently, I use the Address field from the
> DEVICE_CAPABILITIES. However, this isn’t unique across all hubs.
>
> I’ve tried looking through the DDK, searching through Google, various user
> groups, and www.usb.org, but am not quite sure how to phrase the search
> request.
>
> Does anybody know what I should be using? I need a solution that works
for
> both W2K and XP.
>
> Thanks in advance,
> Linda
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@diebold.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

I’ve dealt with the opposite problem, giving one of several USB devices the
same identity regardless how it was plugged into the system.

It seems to me that if you were to give a USB device a name based on where
it was plugged in,
then you need to specify a “path” from the USB controller #x and your device
with all hub and port #s inbetween.

So a device connected to port #3 of a hub, connected to port #5 of a second
hub, connected to root hub port #2 of USB controller #1 would need the
following info

Cport #1,root hub port #2, hub port #5, hub port #3

USBView displays this view, however it obtains it by transversing the USB
like a tree, starting from the hub. Take a look at it, the sources are in
the DDK. It seems like the hardway to obtain the information you want, but I
think it will work.

Larry Harmon

-----Original Message-----
From: Linda Marcellus [mailto:xxxxx@novatel.ca]
Sent: Wednesday, September 10, 2003 6:30 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Binding DeviceId to Usb Port

That’s correct. In your example, the com ports for the device plugged into
the 6th port of the hub plugged into the 3rd port of my PC would get
assigned COM7, COM8, and COM9.

My device does provide a serial number in the device descriptors.

Through trial and error, I’ve seen that the
DevicePropertyPhysicalDeviceObjectName is of the form \Device\USBPDO-n where
n seems to be unique to the hub. Maybe I could use that ‘n’ value and set
my device id string to something like UsbPort-nm, where n is the hub number
and m is the port number (address from the DEVICE_CAPABILITIES).

But will the n value be the same?

Or maybe I should use the PDO’s DevicePropertyAddress so that my device id
is something like UsbPort-E4FC3328_m.

I’m kind of leaning toward the latter.

Linda

“Harmon, Larry (CT)” wrote in message
news:xxxxx@ntdev…
>
> Lets see if I understand you correctly.
>
> If a PC has 4 USB ports and you plug your device into the 1st port you
want
> the virtual serial ports to be named COM1, COM2 & COM3.
>
> If your device is plugged into the 2nd you want the virtual serial ports
to
> be named COM4, COM5 & COM6.
>
> Now if a 6 port hub is plugged into the 3rd port and your device is
plugged
> into the hubs 6th port then ???
>
> It seems to me that you need to know the name of “parent port” your device
> is attached to then base the name off of that.
>
> Larry
>
> PS If your USB device DOES NOT provide a serial number via the device
> descriptor than the symbolic name generated by Windows will contain the
> parent port ID rather than serial # information.
>
> -----Original Message-----
> From: Linda Marcellus [mailto:xxxxx@novatel.ca]
> Sent: Wednesday, September 10, 2003 1:23 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Binding DeviceId to Usb Port
>
>
> Hi,
> I’ve written a driver for a usb device which provides three virtual serial
> ports. In my implementation I have two drivers: the driver for my usb
> device, which acts as a bus, and a driver for my virtual serial devices.
>
> I would like the same 3 com ports to be assigned to any device attached to
a
> particular usb port, regardless of which physical device is plugged in.
>
> In response to a IRP_MN_QUERY_ID BusQueryDeviceID request, I would like my
> PDO to return an id string uniquely identifying which usb port my device
is
> connected to. Currently, I use the Address field from the
> DEVICE_CAPABILITIES. However, this isn’t unique across all hubs.
>
> I’ve tried looking through the DDK, searching through Google, various user
> groups, and www.usb.org, but am not quite sure how to phrase the search
> request.
>
> Does anybody know what I should be using? I need a solution that works
for
> both W2K and XP.
>
> Thanks in advance,
> Linda
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@diebold.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@diebold.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Ideally, I’d like to start at my fdo and walk down to the root hub, but I
guess I can’t do that. I’ll have to enumerate the entire tree and figure
out which path I’m on.

“Harmon, Larry (CT)” wrote in message
news:xxxxx@ntdev…
>
>
> I’ve dealt with the opposite problem, giving one of several USB devices
the
> same identity regardless how it was plugged into the system.
>
> It seems to me that if you were to give a USB device a name based on where
> it was plugged in,
> then you need to specify a “path” from the USB controller #x and your
device
> with all hub and port #s inbetween.
>
> So a device connected to port #3 of a hub, connected to port #5 of a
second
> hub, connected to root hub port #2 of USB controller #1 would need the
> following info
>
> Cport #1,root hub port #2, hub port #5, hub port #3
>
> USBView displays this view, however it obtains it by transversing the USB
> like a tree, starting from the hub. Take a look at it, the sources are in
> the DDK. It seems like the hardway to obtain the information you want, but
I
> think it will work.
>
> Larry Harmon
>
>
>
> -----Original Message-----
> From: Linda Marcellus [mailto:xxxxx@novatel.ca]
> Sent: Wednesday, September 10, 2003 6:30 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Binding DeviceId to Usb Port
>
>
> That’s correct. In your example, the com ports for the device plugged
into
> the 6th port of the hub plugged into the 3rd port of my PC would get
> assigned COM7, COM8, and COM9.
>
> My device does provide a serial number in the device descriptors.
>
> Through trial and error, I’ve seen that the
> DevicePropertyPhysicalDeviceObjectName is of the form \Device\USBPDO-n
where
> n seems to be unique to the hub. Maybe I could use that ‘n’ value and set
> my device id string to something like UsbPort-nm, where n is the hub
number
> and m is the port number (address from the DEVICE_CAPABILITIES).
>
> But will the n value be the same?
>
> Or maybe I should use the PDO’s DevicePropertyAddress so that my device id
> is something like UsbPort-E4FC3328_m.
>
> I’m kind of leaning toward the latter.
>
> Linda
>
>
> “Harmon, Larry (CT)” wrote in message
> news:xxxxx@ntdev…
> >
> > Lets see if I understand you correctly.
> >
> > If a PC has 4 USB ports and you plug your device into the 1st port you
> want
> > the virtual serial ports to be named COM1, COM2 & COM3.
> >
> > If your device is plugged into the 2nd you want the virtual serial ports
> to
> > be named COM4, COM5 & COM6.
> >
> > Now if a 6 port hub is plugged into the 3rd port and your device is
> plugged
> > into the hubs 6th port then ???
> >
> > It seems to me that you need to know the name of “parent port” your
device
> > is attached to then base the name off of that.
> >
> > Larry
> >
> > PS If your USB device DOES NOT provide a serial number via the device
> > descriptor than the symbolic name generated by Windows will contain the
> > parent port ID rather than serial # information.
> >
> > -----Original Message-----
> > From: Linda Marcellus [mailto:xxxxx@novatel.ca]
> > Sent: Wednesday, September 10, 2003 1:23 PM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] Binding DeviceId to Usb Port
> >
> >
> > Hi,
> > I’ve written a driver for a usb device which provides three virtual
serial
> > ports. In my implementation I have two drivers: the driver for my usb
> > device, which acts as a bus, and a driver for my virtual serial devices.
> >
> > I would like the same 3 com ports to be assigned to any device attached
to
> a
> > particular usb port, regardless of which physical device is plugged in.
> >
> > In response to a IRP_MN_QUERY_ID BusQueryDeviceID request, I would like
my
> > PDO to return an id string uniquely identifying which usb port my device
> is
> > connected to. Currently, I use the Address field from the
> > DEVICE_CAPABILITIES. However, this isn’t unique across all hubs.
> >
> > I’ve tried looking through the DDK, searching through Google, various
user
> > groups, and www.usb.org, but am not quite sure how to phrase the search
> > request.
> >
> > Does anybody know what I should be using? I need a solution that works
> for
> > both W2K and XP.
> >
> > Thanks in advance,
> > Linda
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@diebold.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@diebold.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

> In response to a IRP_MN_QUERY_ID BusQueryDeviceID request, I would like my

PDO to return an id string uniquely identifying which usb port my device is
connected to. Currently, I use the Address field from the
DEVICE_CAPABILITIES. However, this isn’t unique across all hubs.

IIRC the USB bus topology is just not accessible for the USB function drivers,
being buried deep in USBHUB code.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Linda,

I wanted to put a graphical connection display in my control panel
property page showing the connection, but I couldn’t figure out how to
traverse the tree from the device to the controller( backwards). If you do,
please let me know how. But for now its like you said, you must enumerate
each USB controller tree until you find your device.

Good Luck
Larry

-----Original Message-----
From: Linda Marcellus [mailto:xxxxx@novatel.ca]
Sent: Friday, September 12, 2003 6:41 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Binding DeviceId to Usb Port

Ideally, I’d like to start at my fdo and walk down to the root hub, but I
guess I can’t do that. I’ll have to enumerate the entire tree and figure
out which path I’m on.

“Harmon, Larry (CT)” wrote in message
news:xxxxx@ntdev…
>
>
> I’ve dealt with the opposite problem, giving one of several USB devices
the
> same identity regardless how it was plugged into the system.
>
> It seems to me that if you were to give a USB device a name based on where
> it was plugged in,
> then you need to specify a “path” from the USB controller #x and your
device
> with all hub and port #s inbetween.
>
> So a device connected to port #3 of a hub, connected to port #5 of a
second
> hub, connected to root hub port #2 of USB controller #1 would need the
> following info
>
> Cport #1,root hub port #2, hub port #5, hub port #3
>
> USBView displays this view, however it obtains it by transversing the USB
> like a tree, starting from the hub. Take a look at it, the sources are in
> the DDK. It seems like the hardway to obtain the information you want, but
I
> think it will work.
>
> Larry Harmon
>
>
>
> -----Original Message-----
> From: Linda Marcellus [mailto:xxxxx@novatel.ca]
> Sent: Wednesday, September 10, 2003 6:30 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Binding DeviceId to Usb Port
>
>
> That’s correct. In your example, the com ports for the device plugged
into
> the 6th port of the hub plugged into the 3rd port of my PC would get
> assigned COM7, COM8, and COM9.
>
> My device does provide a serial number in the device descriptors.
>
> Through trial and error, I’ve seen that the
> DevicePropertyPhysicalDeviceObjectName is of the form \Device\USBPDO-n
where
> n seems to be unique to the hub. Maybe I could use that ‘n’ value and set
> my device id string to something like UsbPort-nm, where n is the hub
number
> and m is the port number (address from the DEVICE_CAPABILITIES).
>
> But will the n value be the same?
>
> Or maybe I should use the PDO’s DevicePropertyAddress so that my device id
> is something like UsbPort-E4FC3328_m.
>
> I’m kind of leaning toward the latter.
>
> Linda
>
>
> “Harmon, Larry (CT)” wrote in message
> news:xxxxx@ntdev…
> >
> > Lets see if I understand you correctly.
> >
> > If a PC has 4 USB ports and you plug your device into the 1st port you
> want
> > the virtual serial ports to be named COM1, COM2 & COM3.
> >
> > If your device is plugged into the 2nd you want the virtual serial ports
> to
> > be named COM4, COM5 & COM6.
> >
> > Now if a 6 port hub is plugged into the 3rd port and your device is
> plugged
> > into the hubs 6th port then ???
> >
> > It seems to me that you need to know the name of “parent port” your
device
> > is attached to then base the name off of that.
> >
> > Larry
> >
> > PS If your USB device DOES NOT provide a serial number via the device
> > descriptor than the symbolic name generated by Windows will contain the
> > parent port ID rather than serial # information.
> >
> > -----Original Message-----
> > From: Linda Marcellus [mailto:xxxxx@novatel.ca]
> > Sent: Wednesday, September 10, 2003 1:23 PM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] Binding DeviceId to Usb Port
> >
> >
> > Hi,
> > I’ve written a driver for a usb device which provides three virtual
serial
> > ports. In my implementation I have two drivers: the driver for my usb
> > device, which acts as a bus, and a driver for my virtual serial devices.
> >
> > I would like the same 3 com ports to be assigned to any device attached
to
> a
> > particular usb port, regardless of which physical device is plugged in.
> >
> > In response to a IRP_MN_QUERY_ID BusQueryDeviceID request, I would like
my
> > PDO to return an id string uniquely identifying which usb port my device
> is
> > connected to. Currently, I use the Address field from the
> > DEVICE_CAPABILITIES. However, this isn’t unique across all hubs.
> >
> > I’ve tried looking through the DDK, searching through Google, various
user
> > groups, and www.usb.org, but am not quite sure how to phrase the search
> > request.
> >
> > Does anybody know what I should be using? I need a solution that works
> for
> > both W2K and XP.
> >
> > Thanks in advance,
> > Linda
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@diebold.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@diebold.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@diebold.com
To unsubscribe send a blank email to xxxxx@lists.osr.com