Hi all, We are successfully using the USB Gadget HID driver (g_hid) with a MUSB device controller on a 2.6.32 kernel to communicate with a USB host. Now we want to add the wakeup feature so that the device can wakeup the host if the USB bus has been suspended. We have found a simple and working method; but does anyone know of a better/standard/more robust way of doing this? hid.c already contains specifics on our HID descriptors, so we add the feature to the report descriptor: --- drivers/usb/gadget/hid.c +++ drivers/usb/gadget/hid.c @@ -152,7 +152,7 @@ .bind = do_config, .bConfigurationValue = 1, /* .iConfiguration = DYNAMIC */ - .bmAttributes = USB_CONFIG_ATT_SELFPOWER, + .bmAttributes = USB_CONFIG_ATT_SELFPOWER | USB_CONFIG_ATT_WAKEUP, }; f_hid.c reads data from userspace and writes to the endpoint. All sent data is treated equal (this is of course application dependant) and should wakeup the host if sleeping: --- drivers/usb/gadget/f_hid.c +++ drivers/usb/gadget/f_hid.c @@ -240,6 +240,8 @@ hidg->req->context = hidg; hidg->write_pending = 1; + usb_gadget_wakeup(hidg->func.config->cdev->gadget); + status = usb_ep_queue(hidg->in_ep, hidg->req, GFP_ATOMIC); if (status < 0) { //ERROR(hidg->func.config->cdev, The usb_gadget_wakeup() lies in the hotpath, but the MUSB controller driver will only send the resume signal in case the bus is suspended and the host does support wakeup (musb_gadget.c:musb_gadget_wakeup()). Alternatively, one could signal the MUSB controller directly from userspace, but that will also lie in the hotpath and has even more overhead. echo 1 > /sys/devices/platform/musb_hdrc/srp Does anyone have any suggestions on a better location for this kind of wakeup functionality? In the MUSB controller driver? In the composite driver? Regards, Pablo ------------------------- Pablo Cases, M.Sc. Development Engineer Software FlatFrog Laboratories AB Magistratsvägen 10 22643 Lund Sweden Tel: +46 708 393816 Mail: pc@xxxxxxxxxxxx Web: www.flatfrog.com -- 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