On Wed, 1 Sep 2010, Oliver Neukum wrote: > Oh, there's another little problem in autosuspend_check() > > /* Don't allow autosuspend if the device will need > * a reset-resume and any of its interface drivers > * doesn't include support or needs remote wakeup. > */ > if (udev->quirks & USB_QUIRK_RESET_RESUME) { > struct usb_driver *driver; > > driver = to_usb_driver(intf->dev.driver); > if (!driver->reset_resume || > intf->needs_remote_wakeup) > return -EOPNOTSUPP; > > This means devices with this quirk will be suspended. If all the conditions are met. > Which in means > that medium change events will be lost. I think for devices with this quirk > we can autosuspend only if there's no medium present. Furthermore > you'll probably need to introduce a new flag to signal this requirement > to usbcore. How? usbcore knows nothing about media. The best solution is for usb-storage to disallow autosuspend if the quirk is set. > > > > For those buggy readers, it would be better to have something > > > > which could be implemented as a sysfs attribute in usb-storage. > > > > > > Why usb-storage? Any drive for real rotational media has the same > > > requirement. > > > Waiting for minutes for a suspend without medium is ridiculous, > > > as is spinning down a disk after only two seconds. > > > > Suggestions for a sysfs interface? Should the sd driver add its own > > "suspend_delay_no_medium" attribute? > > Hm. I see no connection to sd. In fact I see no connection to block > devices. Tapes have this issue, too. It could be added for all SCSI devices. But wouldn't it be easier simply to use a fixed delay when there's no medium? We could pick a value like 100 ms or make it a module parameter. There's a problem about communicating the delay value to the PM layer. The code I'm adding to the PM core assumes a device has only a single delay: the current suspend_delay value. That current value will be the one to show up in the "suspend_delay_ms" sysfs attribute. So for example, you wouldn't be able to set the medium-present delay value at a time when no media was loaded. Also, there are potentially problems with drives that take a while to warm up and claim they have no media in the mean time. 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