usb: pass USBEndpoint to usb_wakeup

Devices must specify which endpoint has data to transfer now.
The plan is to use the usb_wakeup() not only for remove wakeup support,
but for "data ready" signaling in general, so we can move away from
constant polling to event driven usb device emulation.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Gerd Hoffmann 2012-01-17 13:25:46 +01:00
parent db4be873d3
commit 7567b51fbe
5 changed files with 15 additions and 7 deletions

View file

@ -44,6 +44,7 @@
typedef struct USBHIDState {
USBDevice dev;
USBEndpoint *intr;
HIDState hid;
} USBHIDState;
@ -360,7 +361,7 @@ static void usb_hid_changed(HIDState *hs)
{
USBHIDState *us = container_of(hs, USBHIDState, hid);
usb_wakeup(&us->dev);
usb_wakeup(us->intr);
}
static void usb_hid_handle_reset(USBDevice *dev)
@ -501,6 +502,7 @@ static int usb_hid_initfn(USBDevice *dev, int kind)
USBHIDState *us = DO_UPCAST(USBHIDState, dev, dev);
usb_desc_init(dev);
us->intr = usb_ep_get(dev, USB_TOKEN_IN, 1);
hid_init(&us->hid, kind, usb_hid_changed);
return 0;
}