HID: usbhid: enable remote wakeup for keyboards
authorAlan Stern <stern@rowland.harvard.edu>
Fri, 2 Apr 2010 17:21:58 +0000 (13:21 -0400)
committerJiri Kosina <jkosina@suse.cz>
Fri, 2 Apr 2010 23:36:03 +0000 (01:36 +0200)
This patch (as1365) enables remote wakeup by default for USB keyboard
devices.  Keyboards in general are supposed to be wakeup devices, but
the correct place to enable it depends on the device's bus; no single
approach will work for all keyboard devices.  In particular, this
covers only USB keyboards (and then only those supporting the boot
protocol).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/usbhid/hid-core.c
drivers/hid/usbhid/usbkbd.c

index 56d06cd8075b32f9cc6faec1f1909925f3f79c43..9cd61a52e9e36f512356ac59a32610b21ebffa8a 100644 (file)
@@ -1026,12 +1026,15 @@ static int usbhid_start(struct hid_device *hid)
        /* Some keyboards don't work until their LEDs have been set.
         * Since BIOSes do set the LEDs, it must be safe for any device
         * that supports the keyboard boot protocol.
+        * In addition, enable remote wakeup by default for all keyboard
+        * devices supporting the boot protocol.
         */
        if (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT &&
                        interface->desc.bInterfaceProtocol ==
-                               USB_INTERFACE_PROTOCOL_KEYBOARD)
+                               USB_INTERFACE_PROTOCOL_KEYBOARD) {
                usbhid_set_leds(hid);
-
+               device_set_wakeup_enable(&dev->dev, 1);
+       }
        return 0;
 
 fail:
index f843443ba5c3efc3764876ed7aa5ab6300f2ef68..b2fd0b00de9276504a1e87f31ebb068eaa8cc755 100644 (file)
@@ -313,6 +313,7 @@ static int usb_kbd_probe(struct usb_interface *iface,
                goto fail2;
 
        usb_set_intfdata(iface, kbd);
+       device_set_wakeup_enable(&dev->dev, 1);
        return 0;
 
 fail2: