[I'm CC'ing this to the Linux PM development list, as it might be of interest to people there.] On Tue, 8 Feb 2005, David Zeuthen wrote: > I see. Ideally, idle-time auto suspend should be something controlled > from user space because it's policy. For Fedora, my guess is that we've > want hal to expose things like "suspend this device" so the policy can > be controlled in a secure way (via D-BUS) all the way up from the > desktop (since the policy chosen may depend on lots of things). Nobody has really settled yet on a good way to do autosuspend. I think people may be aiming toward letting userspace set the policy (i.e., specify an idle timeout or "none") and having the kernel carry out that policy (suspend when the idle timeout expires and resume when needed). The alternative is to have the kernel somehow inform userspace of how much time has passed since the device was last active, with all the races that implies. The ability to perform device-selective suspend/resume operations definitely will be available to userspace via sysfs (/sys/device/.../power/state). Again, the details of how this will work haven't been settled. > Btw, I have no problem letting hal respect a sysfs file (since other > components than hal might want to suspend the device) assuming that I > don't have to poll the file :-). - perhaps the kernel events layer > should be used to signal this also. > > I'm curious though; what happens if I insert media into a USB card > reader and it's suspended? The same thing that happens if it's not suspended -- nothing! The kernel won't communicate with the reader until you try to access it somehow (mount it, for example, or just open the device file). At that time we will autoresume. Actually there is a second possibility. Some USB devices support "remote wakeup", which is a mechanism for sending the host a request to resume the device. If a card reader does support remote wakeup, then likely it will send a remote wakeup request when a new card is inserted while it is suspended. The host will resume the device when the request is received. But currently there is no form of userspace notification when that occurs. Do you think it's important to have some sort of event notification for when devices are selectively suspended and resumed? (BTW, I'm talking about autosuspend and autoresume for USB mass storage devices as though such actions really exist. But they don't, apart from one experimental patch I wrote a few months ago. Eventually they will be implemented though, and then I expect they will work pretty much as I have described.) Alan Stern