On Jul 14, 2011, at 06:31 AM, Xiaofan Chen <xiaofanc@...> wrote:
On Tue, Jul 12, 2011 at 11:39 PM, Alan Stern <stern@...> wrote:
> On Tue, 12 Jul 2011, Xiaofan Chen wrote:
>> On Mon, May 21, 2007 at 5:36 PM, Gaopeng Chen - Sun China
>> <Gaopeng.Chen@...> wrote:
>> > Hi all,
>> > Is it possible to export two new events for libusb_event_t?
>> > USB_SUSPEND
>> > USB_RESUME
>> > I'm working on a fingerprint device, which supports advanced power
>> > management. Users can send a control msg to suspend the device Once a
>> > finger is pressed, the device will wake up and resume. Thus the resume
>> > event is required to be issued. I think this is very useful for USB
>> > devices that's required to be power saved and remote wake-up.
>> This is an old thread.
>> The thread seems to suggest that the above is possible under
>> Linux and Solaris.
>> How to support this under Linux? Is it possible to do similar
>> things for Windows and Mac OS X?
> It's currently not possible under Linux. No event notifications are
> sent to userspace when a device is suspended or resumed. Reference
> lines 506-517; the usbfs suspend and resume routines don't do anything.
> Of course it is theoretically possible to add such notifications, but
> they don't exist now.
> The message in that earlier thread (which seemed to suggest this was
> possible) was wrong. The person who wrote the message misunderstood
> the code.
Thanks for the clarification
Interestingly it can be done under FreeBSD 8.x.
libusb20_dev_set_power_mode() sets the power mode of the USB device.
Valid power modes:
Under Windows, winusb has some power policy as well.
I do not know about Mac OS X but it seems to be possible as well.
Just a note. That API is only for kernel drivers (any not relevant to USB devices afaik). It is possible to read the power state from the IOPower plane (and maybe get notifications) but there is no standard way to modify the power state from an user process.