summary refs log tree commit diff stats
path: root/hw/usb-hid.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-01-17 13:25:46 +0100
committerGerd Hoffmann <kraxel@redhat.com>2012-02-10 12:16:30 +0100
commit7567b51fbe92e1300a672eaddd413c4a7e807d90 (patch)
tree99f49603bb1b279686113e15020145f827777b4a /hw/usb-hid.c
parentdb4be873d312576c6971da15a38e056017a406b8 (diff)
downloadfocaccia-qemu-7567b51fbe92e1300a672eaddd413c4a7e807d90.tar.gz
focaccia-qemu-7567b51fbe92e1300a672eaddd413c4a7e807d90.zip
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>
Diffstat (limited to 'hw/usb-hid.c')
-rw-r--r--hw/usb-hid.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 4d00c2813d..53353d3c20 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -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;
 }