lkml.org 
[lkml]   [2006]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Flames over -- Re: Which is simpler?
Olivier Galibert wrote:
> USB has this additional problem that devices lose their addresses when
> the power is removed (it's very agressively hotplug). So you can have
> the devices moving around under your feet between poweroff and poweron
> just because the devices happened to have enumerated in a different
> order at boot time.
>

Isn't that address abstracted out by the usb layer? i.e. there is no
relationship between the device number and the usb bus address, so
there's no reason the usb layer can't update it's internal data
structures to point the old device to the new bus address. Also if the
USB host controller wants to, can't it assign any address it likes to
each device on the bus? It doesn't HAVE to assign them in sequence as
the devices are enumerated does it?

I'm not all that familiar with USB, but I'd imagine it is somewhat like
I2C/SMBUS: each device has a descriptor block that contains information
about itself. This is going to be unique for any given device. The
host controller begins by querying the broadcast address, and all
unconfigured devices respond. At some point a bit in their descriptor
blocks will differ, and there will be a collision, at which point, the
device trying to transmit a high bit will yield and let the others
continue. Eventually only one device will be left having sent its
entire descriptor block to the host, and the host can then assign a
unique address to that device. The host repeats this until all devices
have been assigned an address.

Because of this, given the same hardware on the bus, the same
enumeration will happen every time, and the host can assign whatever
address it wants to each device should it choose to do so rather than
just assign them in ascending order. If the host wanted to, it could
power down the bus, and when it powers back up, it could assign the same
addresses that they had before to the devices as they are enumerated,
and new devices would get unused addresses.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-02-20 19:24    [W:0.055 / U:25.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site