On Tue, 31 Jul 2012, Sarah Sharp wrote: > On Tue, Jul 31, 2012 at 01:02:43PM -0400, Alan Stern wrote: > > I don't know. I can't think of anything more, but there's a nagging > > feeling that if we use these then something will go wrong. > > > > How about if we start with only the first policy rule: Ports that can > > never have anything plugged in should be shut down automatically. > > Initially, everything else can be left up to userspace. Then we can > > experiment with adding other policies to the kernel. > > Ok, that sounds like a good start. I'm a little fuzzy on the details > though. > > Does that mean you think we should add an "auto" option to the sysfs > file? Then when the file is set to "auto", have the kernel turn off ports > that don't have a USB device connected to it. Have the kernel set the > default sysfs value to auto for unpluggable ports. > > Or do you think userspace should set the sysfs file to "off" after > verifying the port is unpluggable through new sysfs files? Actually, what I had in mind was more like: We add an "auto" option to each port's power-policy sysfs attribute. When the policy is set to "auto" the kernel will turn off power to the port, but only if no USB device can ever be attached to it. Power policy for all ports will default to "on"; userspace can change the policy (perhaps after looking at other sysfs attributes). Alternatively, we could do something more like what you said: Set the default policy to "auto" if no device can ever be attached to the port; otherwise set it to "on". The "auto" policy setting means turn off power to the port, but only if no device is currently attached to it. Later on we can change what "auto" means. I'm not sure which scheme is best in terms of reliability and upward (future) compatilibity. 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