Re: [linux-usb-devel] USB autosuspend and turning of usb pendrive leds
On Sat, 22 Sep 2007, Hans de Goede wrote: > >> Now call me naive, but I would expect a mass-storage devices with no > >> partitions mounted to autosuspend when autosuspend is enabled for that > >> device. > > > > Yes, that is naive. The driver has no way to tell whether or not any > > partitions are mounted. Furthermore, you might very well want to > > access the raw device without mounting any partitions (database > > managers frequently do such things to reduce I/O overhead), in which > > case you certainly would not the device to be autosuspended. > > > > How does this relate to your "It works fine on my systems" remark, do I need > to > do anything other the unmounting the paritions to make the device eligible > for > autosuspend, like unbind the sd driver or even the usb-storage driver? You shouldn't have to do anything. Mounted or unmounted, bound to sd or not bound, it shouldn't matter. Provided the device isn't being used, it ought to autosuspend. I repeat: To find out what is really happening, you should use usbmon. Alan Stern - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [linux-usb-devel] USB autosuspend and turning of usb pendrive leds
Alan Stern wrote: On Sat, 22 Sep 2007, Hans de Goede wrote: I'm afraid that that doesn't work for usb mass-storage devices. Here is what I did: 1) kill hal 2) insert usb stick -> led lights 3): echo -n 1 >/sys/bus/usb/devices/.../power/autosuspend echo -n auto > /sys/bus/usb/devices/.../power/level 4) wait Nothing happens, where as sending "suspend" to power/level does turn the led off. I don't know what went wrong. It works fine on my systems. You did fill in the correct device path for the "...", right? Yes, the one that comes and goes as I plug in one of the USB-sticks I ue for testing. And you don't need the "-n" -- adding it shouldn't matter, but you should try reading back the contents of those files to make sure the values did get written correctly. I did read them back and it did get written correctly. Now call me naive, but I would expect a mass-storage devices with no partitions mounted to autosuspend when autosuspend is enabled for that device. Yes, that is naive. The driver has no way to tell whether or not any partitions are mounted. Furthermore, you might very well want to access the raw device without mounting any partitions (database managers frequently do such things to reduce I/O overhead), in which case you certainly would not the device to be autosuspended. How does this relate to your "It works fine on my systems" remark, do I need to do anything other the unmounting the paritions to make the device eligible for autosuspend, like unbind the sd driver or even the usb-storage driver? If so I must say I find that a little counter intuitive. Regards, Hans p.s. As always, please keep me CC-ed, not on the list. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [linux-usb-devel] USB autosuspend and turning of usb pendrive leds
On Sat, 22 Sep 2007, Hans de Goede wrote: > I'm afraid that that doesn't work for usb mass-storage devices. > > Here is what I did: > 1) kill hal > 2) insert usb stick -> led lights > 3): > echo -n 1 >/sys/bus/usb/devices/.../power/autosuspend > echo -n auto > /sys/bus/usb/devices/.../power/level > > 4) wait > > Nothing happens, where as sending "suspend" to power/level does turn the led > off. I don't know what went wrong. It works fine on my systems. You did fill in the correct device path for the "...", right? And you don't need the "-n" -- adding it shouldn't matter, but you should try reading back the contents of those files to make sure the values did get written correctly. > Now call me naive, but I would expect a mass-storage devices with no > partitions mounted to autosuspend when autosuspend is enabled for that device. Yes, that is naive. The driver has no way to tell whether or not any partitions are mounted. Furthermore, you might very well want to access the raw device without mounting any partitions (database managers frequently do such things to reduce I/O overhead), in which case you certainly would not the device to be autosuspended. > And yes I'm pretty sure nothing else is talking to the device. You can be absolutely certain by using usbmon (see Documentation/usb/usbmon.txt). It will also show whether any suspends or resumes are actually being sent. Alan Stern - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [linux-usb-devel] USB autosuspend and turning of usb pendrive leds
Alan Stern wrote: The correct answer is that HAL should top polling while the device is suspended. In kernels starting with 2.6.23-rc6, the correct way to enable autosuspend for a USB device is basically like this: echo D >/sys/bus/usb/devices/.../power/autosuspend echo auto >/sys/bus/usb/devices/.../power/level I'm afraid that that doesn't work for usb mass-storage devices. Here is what I did: 1) kill hal 2) insert usb stick -> led lights 3): echo -n 1 >/sys/bus/usb/devices/.../power/autosuspend echo -n auto > /sys/bus/usb/devices/.../power/level 4) wait Nothing happens, where as sending "suspend" to power/level does turn the led off. Now call me naive, but I would expect a mass-storage devices with no partitions mounted to autosuspend when autosuspend is enabled for that device. And yes I'm pretty sure nothing else is talking to the device. As usual keep please me CC-ed as I'm not on the list. Regards, Hans - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [linux-usb-devel] USB autosuspend and turning of usb pendrive leds
Am Freitag 21 September 2007 schrieb Hans de Goede: > Thats not what I had in mind, autosuspend doesn't work (presumably because > hal > keeps polling for media change) maybe I should fix hal to not keep polling > for > devices which don't have removable media? If you find a way to tell which devices fall into that class. Regards Oliver - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [linux-usb-devel] USB autosuspend and turning of usb pendrive leds
On Fri, 21 Sep 2007, Jiri Kosina wrote: > (linux-usb-devel needs CC) > > On Fri, 21 Sep 2007, Hans de Goede wrote: > > > 1) Would it be possible to funtionality to the kernel to suspend a device in > >such a way that it will automatically unsuspend when used again? > > It is possible - USB now supports autosuspend. After a long debate, it was > however devcided that it is explicitly turned off, and userspace is free > to turn it on via sysfs interface for whatever devices the user likes to > do so. > > This is mainly because there is a huge load of USB devices out there that > don't support this feature correctly, and we will break them if we perform > autosuspend automatically. > > > 2) Would it be possible to still make the polls succeed then with out > >unsuspending the device (or atleast without doing something that > >would make the led light again, what makes the led light exactly is > >unknown), or should hal stop polling then? The correct answer is that HAL should top polling while the device is suspended. In kernels starting with 2.6.23-rc6, the correct way to enable autosuspend for a USB device is basically like this: echo D >/sys/bus/usb/devices/.../power/autosuspend echo auto >/sys/bus/usb/devices/.../power/level where D is the time (in seconds) the device should remain idle before it is autosuspended. An autosuspended device will be woken up to respond to polls. (Note however that in this kernel, autosuspend support for USB mass-storage devices was removed because it can cause problems related to spinning down disk drives.) If instead you do echo suspend >/sys/bus/usb/devices/.../power/level it will simply suspend the device immediately. The device will not be woken up automatically and attempts to poll it (or do anything else) will fail. Alan Stern - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/