aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/core.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-08-28 09:43:18 +0200
committerGerd Hoffmann <kraxel@redhat.com>2012-09-11 07:42:59 +0200
commitc13a9e61366cc3e28299d8faeb65e65c6e5964cf (patch)
tree81cb8ecad6a9c5ec9cf963fb37966a41c8150d33 /hw/usb/core.c
parentcc40997489260f405aecccd30d4626ceee862502 (diff)
usb-core: Add a usb_ep_find_packet_by_id() helper function
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/core.c')
-rw-r--r--hw/usb/core.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/hw/usb/core.c b/hw/usb/core.c
index be6d936881..fe431d02d9 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -726,3 +726,18 @@ void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled)
struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
uep->pipeline = enabled;
}
+
+USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep,
+ uint64_t id)
+{
+ struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
+ USBPacket *p;
+
+ while ((p = QTAILQ_FIRST(&uep->queue)) != NULL) {
+ if (p->id == id) {
+ return p;
+ }
+ }
+
+ return NULL;
+}