Q: How does USB hubs work? Re: Multiple USB Devices

Joe Pfeiffer jjpfeifferjr at comcast.net
Wed Jan 31 16:20:04 CET 2007


Robert Michel writes:
>> 
>> Brilliant! Thanks for that :-)
>
>So now the question, how does an USB hub work?
>Can we plug in the host on any port?

Short form:  USB is strictly a hierarchical, tree-structured network.
There is one host, which may connect to the upstream port on a hub;
you can then plug in more hubs and devices downstream of the hub.
They were very careful when writing to the standard to specify cables
that can't plug in the wrong way:  you can only plug a host into the
(single) upstream port on the hub.

Long form:
http://viper.cs.nmsu.edu:8000/classes/473/notes/usb.php?currentsem=s06

Really long form (this is the USB 2.0 specification)
http://www.usb.org/developers/docs/usb_20_05122006.zip

>The Neo1973 will have mini-USB-B
>
>normal hubs powered USB-A for the adapter 
>and one unpowerd USB-B for the host.

My understanding is that it will be USB On-The-Go, so it will have a
mini-AB connector which violates almost everything I said in my first
paragraph, and lets it get plugged in either upstream or
downstream.  The point of this is that if you plug it in to the
upstream side of a hub, it will decide it's a host and behave
accordingly.  If you plug it into the downstream side, it will decide
it's a device (and, again, behave accordingly).

>So to connect the Neo with a PC we have a mini-USB-B to USB-A cable. 
>1.) Can we plug the Neo with USB-A it into the (battery powered) hub
>    and charge it whith it?  (I think yes)
>2.) Can we plug the Neo with USB-A it into the (battery powered) hub
>    and use an USB device plugged into the hub?

A compliant hub does not supply any power to the upstream device.  If
you plug the Neo in to the upstream side of the hub (so it thinks it's
a host), it can't be charged by the hub.  Of course, there are *lots*
of noncompliant devices out there, including some that are expressly
forbidden by the standard (but my USB "extension cord" is quite handy,
thank you).  For that matter, the NEO's unpowered USB when acting as a
host is already noncompliant.  No reason (other than compliance!) you
couldn't build a hub that supplied upstream power, but I don't know of
any on the market at the moment.

>So reducing the USB connector and adapter mess...
>we could modifiy a (battery powered) hub in a way that on USB-A port
>will be an unpowered one (or just switchable power). Then could
>we deccide if we want to charge the Neo with the hub or not.
>(And we don't need a mini-USB-B to USB-B cable/adapeter)
>
>So how behave USB hubs? Just stupied forwarding to every port,
>no special host port (internaly)?

The host ends up knowing the tree topology, so I think it does
switching.  But I don't remember.

>PS: And what would happen when two hosts are connected to one hub?

Can't be done.  Protocol doesn't support it, it would require a
horribly noncompliant (as opposed to merely noncompliant, as in some
of the examples above) hub to make it work.  The USB network products
that you can get that you plug two hosts into are two USB devices (one
talking to each host), with a non-USB protocol talking between them.





More information about the community mailing list