On Fri, 7 Mar 2014, Oliver Neukum wrote: > On Fri, 2014-03-07 at 10:14 -0500, Alan Stern wrote: > > On Fri, 7 Mar 2014, Oliver Neukum wrote: > > > > > > Are there any wakeup-enabled devices that this will mess up? > > > > > > Potentially HID. Now that I think about this it seems to me that > > > drivers really need to be told about the error condition. For > > > btusb the error condition cannot be handled. For HID it may mean > > > a lost key or click at the worst. The driver should react to such > > > errors by disabling power management, but that requires that it > > > become aware of such errors. > > > > The only way to notify the driver about the error condition is by a > > reset-resume callback, and btusb has no such callback. > > I wouldn't object to adding reset_resume() provided you add an error > flag and usbcore can deal with a failure. What would you like usbcore to do? Could btusb's reset-resume callback (if such a routine were written) do the same thing? > > In the case of a mobile device, it seems to me that unbinding and > > rebinding is more suitable than disabling power management. > > Especially if these errors are infrequent. > > It breaks opened fds. Of course. So does logical disconnect. And while never resuming the class driver doesn't break opened fds, it leaves them unusable, which is just as bad. The only way to avoid blowing away the old connections is to have a reset-resume callback -- and even that might not be able to do it. The advantage of not disabling power management is that you don't drain the battery. If the user knows that the bluetooth device's power management is unreliable then the user can manually disable runtime suspend. > > Of course, unbind followed by rebind is a natural side effect of > > logical disconnect. > > > > Earlier, you objected to rebinding on the grounds that it could lead to > > a tight error loop. Unbinding without rebinding would be essentially > > the same as what the kernel does now. > > Yes, I much prefer drivers to be notified. Then we need to add a reset-resume callback to btusb. 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