On Wed, Jul 18, 2012 at 12:40:38PM -0400, Alan Stern wrote: > On Wed, 18 Jul 2012, Oliver Neukum wrote: > > > On Wednesday 18 July 2012 11:42:50 Alan Stern wrote: > > > On Wed, 18 Jul 2012, Oliver Neukum wrote: > > > > > > > On Wednesday 18 July 2012 10:54:20 Alan Stern wrote: > > > > > On Wed, 18 Jul 2012, Lan Tianyu wrote: > > > > > > > > > > > On 2012/7/18 22:19, Alan Stern wrote: > > > > > > > An alternative to her suggestion would be to disconnect the device when > > > > > > > the port goes off. When the port is powered back on, the device will > > > > > > > be rediscovered and probed again. > > > > > > hi alan: > > > > > > Reprobe may cause the devnum change. Userspace will treat it a > > > > > > different device from previous one. e.g app held the device node fd, > > > > > > After port went off and on, device reprobed and the fd became invalid. > > > > > > > > > > That's right. Your argument suggests that power-off should be > > > > > controlled by userspace, not by the kernel, and it should happen only > > > > > when no app is holding the device node open. > > > > > > > > That is a race. And it is basically unsolvable in user space if the device > > > > is available to everybody. > > > > > > Everything userspace does is a race. > > > > Therefore some things should be done in kernel space ;-) > > Oliver, you seem to be arguing both sides of this discussion. You > point out the the power-off operation is too dangerous in general for > the kernel to do it, and now you say that it's too racy for userspace > to do it. > > Are we to infer that you don't want it to be done at all? > > What about things like the ubiquitous USB webcams one finds in laptops > these days? I practically never use the one in my laptop, so turning > off its bus power seems like a good idea. Even if that means I have to > turn the power on explicitly before using the webcam. Are there any webcams that require firmware? Perhaps we can look at the drivers on a case-by-case basis and see if we can power off the port during suspend. Sarah Sharp -- 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