Re: Flames over -- Re: Which is simpler?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux