On Mon, 16 Jul 2012, Pete Batard wrote:

> On 2012.07.16 11:43, Markus wrote:
> > Is it correct that the root hub of a host controller has always
> > address 255 on the given USB bus?
> 
> To answer your question, no that is not the case, at least across 
> platforms. On Windows however root hubs will always have 255 as their 
> address.

It's a little more complicated than that.  Let's start by making a
careful distinction between a "device address" and a "device number".

The device address is the actual value used on the USB bus to identify
the device.  It is a 7-bit number, and it can take on any value from 0
to 127.  However 0 is reserved for newly-connected devices; by the time
a device has been enumerated its address will be > 0.

The device number is the value used by the operating system or other
software to identify the device.  Valid ranges will depend on the
operating system.  Quite often it is the same as the device address,
but not always.  (In USB-3, for example, addresses are assigned 
automatically by the host controller hardware and not revealed to the 
operating system.  Consequently the OS has to make up a device number, 
which bears no relation to the device address.)

Getting back to the original question...  Root hubs do not have device
addresses at all, because packets on the USB bus are never addressed to
the root hub.  No packet sent by the host is meant for the root hub,
whereas every packet sent by an external device is (again, with a few
special exceptions in USB-3); either way there's no need for a root-hub
address.

However root hubs do have device numbers.  The value depends on the 
operating system.  In Linux the root hub's device number is always 1; 
In Windows the value currently used by libusbx is always 255.  The 
actual value is rather arbitrary, since it never appears on the USB 
bus.

Alan Stern


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to