On Tue, 21 Apr 2009, Jamie Lokier wrote: > Ingo Molnar wrote: > > * Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote: > > > But more importantly... USB *CANNOT* do this fundamental > > > operation. USB does not have the capability to know when you have > > > seen all devices that are connected. Devices just show up a random > > > amount of time after you turn the power on for the bus.... there's > > > no "and now we've seen all" operation. > > > > Yes - and this is fundamentally true of any hotplug bus design. > > It's not fundamental, for devices you know are plugged in at boot. > All it takes is for the bus to support a synchronous "enumerate all" > procedure. That _could_ involve a timeout, but there are better ways. > But not for USB. Is that last sentence necessarily true? I suppose it is true that a USB device isn't obligated to make its presence on the bus known immediately, but nevertheless, most of them do. In theory we could add code to the USB subsystem to detect when the hub driver has become idle and therefore all devices that were initially plugged in have been probed. That probably would work for solving the console problem. Storage devices present additional problems, however: When usb-storage discovers a device, it generally delays a while before scanning it. (The default delay is 5 seconds, but it is adjustable by a module parameter.) And then when the scanning function is called, the SCSI subsystem turns it into an asynchronous request -- that's why the kernel log usually says "usb-storage: device scan complete" before the scan has in fact begun. So I don't know about determining when all USB mass-storage devices have been detected, but USB serial devices should be practical. If somebody would like to suggest a programming interface (a waitqueue perhaps?) by which the USB hub driver could send a notification when it becomes idle, I could implement it. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html