On Thu, 26 Jun 2014, Dennis New wrote: > > > I wonder if this unbind'ing and bind'ing should be done > > > automatically, when a crash is detected? > > > > That's a separate discussion. To a large degree it doesn't matter, > > because most hardware is designed not to crash during use. > > > > In fact, if you wanted to, you could write a shell script that would > > monitor your system, looking for one of these crashes maybe once every > > few seconds. When a crash occurred, the script could then do the > > unbind and rebind. It doesn't need to be handled automatically in > > the kernel. > > That sounds like an ugly workaround, since the kernel already has a > direct "hook" with the crash event :p. Why would one prefer to simply > "disconnect" the device (and then maybe have the user manually rebind > it) rather than "reconnect" it right away? Unless it's assumed that > such crashes are unrecoverable? I don't know whether general crashes are recoverable or not. You would think that resetting the controller would fix it, but who knows? Such crashes are very rare (provided the driver doesn't deliberately cause a crash by giving bad data to the controller). Yours is the only one I can remember coming across where they happened on a regular basis. (On the other hand, there is old code in the driver that implements exactly this sort of reset and restart for the NEC chips used in Apple PowerBooks. I assume they contained a more widespread bug than the one affecting your system, since there is a comment stating that Apple had to insert a similar workaround in their Darwin driver.) Also, not all USB devices can recover from such a crash without being unplugged. When one of them is present, user intervention will be necessary regardless of what the kernel does. However, the real reason for not doing this is because of a general policy in the kernel: Driver binding happens automatically when a new device is detected or a new driver is loaded, and unbinding happens automatically when a device is hot-unplugged, but therwise neither binding nor unbinding is automatic. They happen only when the user requests them. The change you're talking about would potentially require changes to _every_ driver in the kernel! Whenever a driver detected that its device wasn't working right, it would have to reset the device and rebind to it. A few drivers may do that already, but the vast majority don't. And if they did, all that extra code would be mostly wasted because these crashes are so rare. 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