Discussion:
USB Device versus Interface
(too old to reply)
Frank Natoli
2010-08-25 22:17:30 UTC
Permalink
I understand that one USB device and declare multiple interfaces. What
I would like to do is declare two separate vendor/product codes on a
single USB interface. Is this possible? One socket, one electrical
connection, look like two devices: vendor A product X and vendor A
product Y. Can do?
Philip Ries [MSFT]
2010-08-25 23:41:29 UTC
Permalink
You would need to make a compound device, which would look like this
internally:

Hub
\- Device X
\- Device Y

If you don't actually need different product codes, you can also make a
composite device, which gets multiple drivers loaded such that each
driver owns a set of endpoints exclusively. By default the sets of
endpoints are defined by the interfaces in the configuration descriptor.
Post by Frank Natoli
I understand that one USB device and declare multiple interfaces. What
I would like to do is declare two separate vendor/product codes on a
single USB interface. Is this possible? One socket, one electrical
connection, look like two devices: vendor A product X and vendor A
product Y. Can do?
Frank Natoli
2010-08-26 00:12:27 UTC
Permalink
Many thanks for your reply.

I do need the different product codes, so the "compound device" would
appear to fit the bill.

The hardware guy has picked for the circuit board a three port USB
hub, the Cypress CY7C65631. Two ports must go to two SSDs. The third
port goes to the CPU USB. But the CPU USB needs to represent two
devices, same vendor ID but different product IDs. The "compound
device" saves the day, don't need to find a four port USB hub.

However, your reply appears to indicate that the CPU must represent
itself as a hub in order to then portray the "compound device". Is
that correct?
Philip Ries [MSFT]
2010-08-27 21:14:03 UTC
Permalink
So you need 4 USB-connected devices inside of your device? Then it
would be best to use a 4-port hub rather than a second internal hub.
USB-connected devices can only be 5 hubs deep, and each layer of hub you
add internally takes away from the number of external hubs the user can
use between the system and your device.

Be sure to set the removable bits correctly in the hub descriptor(s) so
that Windows knows which devnodes belong to the device.
Post by Frank Natoli
Many thanks for your reply.
I do need the different product codes, so the "compound device" would
appear to fit the bill.
The hardware guy has picked for the circuit board a three port USB
hub, the Cypress CY7C65631. Two ports must go to two SSDs. The third
port goes to the CPU USB. But the CPU USB needs to represent two
devices, same vendor ID but different product IDs. The "compound
device" saves the day, don't need to find a four port USB hub.
However, your reply appears to indicate that the CPU must represent
itself as a hub in order to then portray the "compound device". Is
that correct?
Tim Roberts
2010-08-26 04:45:26 UTC
Permalink
Post by Frank Natoli
I understand that one USB device and declare multiple interfaces. What
I would like to do is declare two separate vendor/product codes on a
single USB interface. Is this possible? One socket, one electrical
connection, look like two devices: vendor A product X and vendor A
product Y. Can do?
Only if your device can itself be a hub, plus the two separate devices
behind it. That's a lot of work, and most basic USB micros won't do it.

However, it is trivial to make a composite device by putting two interfaces
in your descriptor. Each interface is treated by Windows as a separate
device, with it's own driver stack.
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
Frank Natoli
2010-08-26 09:52:49 UTC
Permalink
Thanks, Tim, but when Phil first replied, he appeared to say that a
"composite" device can only describe a single vendor ID and product
ID. But since I need to represent two separate SSDs, and each needs to
be distinguished by different product IDs, it would appear that
"composite" won't do, and "compound" is necessary, correct?

I may be forced to tell the hardware guy that he needs to find a four
port chip.
Maxim S. Shatskih
2010-08-26 19:01:51 UTC
Permalink
Post by Frank Natoli
Thanks, Tim, but when Phil first replied, he appeared to say that a
"composite" device can only describe a single vendor ID and product
ID.
Yes.
Post by Frank Natoli
"composite" won't do, and "compound" is necessary, correct?
Yes.

Since you already have a hub, you need 4port hub and not 3port, and thus 2 CPUs each with its own vendor/product ID.

P.S. Reading the USB spec helps a lot :-)
--
Maxim S. Shatskih
Windows DDK MVP
***@storagecraft.com
http://www.storagecraft.com
Maxim S. Shatskih
2010-08-26 18:55:04 UTC
Permalink
Post by Frank Natoli
single USB interface. Is this possible? One socket, one electrical
connection, look like two devices: vendor A product X and vendor A
product Y. Can do?
Embed a hub to the device. The usual and normal way.
--
Maxim S. Shatskih
Windows DDK MVP
***@storagecraft.com
http://www.storagecraft.com
Loading...