Steve Glendinning <steve@xxxxxxxxxxx> writes: >>> udev->do_remote_wakeup is set in choose_wakeup() in >>> drivers/usb/core/driver.c. AFAICS it is always set as long as >>> device_may_wakeup(&udev->dev) is true. >> >> That's right. But is device_may_wakeup(&udev->dev) true? >> >> By default it wouldn't be. The normal way to set it is for the user or >> a program to do: >> >> echo enabled >/sys/bus/usb/devices/.../power/wakeup >> >> Of course, a driver could disregard the user's choice and set the flag >> by itself. > > If I set that from userspace the system is able to resume, but I can't > work out how to successfully set this from the driver. I believe the > driver should be overriding this as if the user has asked for the > device to wake on lan they're expecting this to resume the system. > > I've tried placing various combinations of device_set_wakeup_capable > and device_set_wakeup_enable in different places (bind, suspend), but > it still doesn't allow the device to resume from suspend. How should > I do this? I may be completely wrong here, but this is how I believe it is supposed to work... The device can be suspended for two possible reasons: 1) system suspend. If the user want the device to wake the system, then (s)he will do echo enabled >/sys/bus/usb/devices/.../power/wakeup If this isn't set, then there is no reason for the driver to request remote wakeup while the system is suspended. 2) autosuspend. Any interface driver needing remote wakeup will set intf->needs_remote_wakeup, which makes autosuspend_check() set udev->do_remote_wakeup If all my guesses and assumptions are right, then you want to set intf->needs_remote_wakeup unconditionally. This will make the USB core enable remote wakeup on autosuspend. Remote wakeup will not be enabled on system suspend unless the user (or a userspace program on the users behalf) has requested it. Bjørn -- 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