|
Hans de Goede |
c8dfc6 |
From d42de93ca42a6d3b5101ec3db474f52a87a07a63 Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
c8dfc6 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
c8dfc6 |
Date: Tue, 28 Aug 2012 09:43:18 +0200
|
|
Hans de Goede |
c8dfc6 |
Subject: [PATCH 303/366] usb-core: Add a usb_ep_find_packet_by_id() helper
|
|
Hans de Goede |
c8dfc6 |
function
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
c8dfc6 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
c8dfc6 |
---
|
|
Hans de Goede |
c8dfc6 |
hw/usb.h | 2 ++
|
|
Hans de Goede |
c8dfc6 |
hw/usb/core.c | 15 +++++++++++++++
|
|
Hans de Goede |
c8dfc6 |
2 files changed, 17 insertions(+)
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
diff --git a/hw/usb.h b/hw/usb.h
|
|
Hans de Goede |
c8dfc6 |
index b8fceec..684e3f4 100644
|
|
Hans de Goede |
c8dfc6 |
--- a/hw/usb.h
|
|
Hans de Goede |
c8dfc6 |
+++ b/hw/usb.h
|
|
Hans de Goede |
c8dfc6 |
@@ -377,6 +377,8 @@ void usb_ep_set_max_packet_size(USBDevice *dev, int pid, int ep,
|
|
Hans de Goede |
c8dfc6 |
uint16_t raw);
|
|
Hans de Goede |
c8dfc6 |
int usb_ep_get_max_packet_size(USBDevice *dev, int pid, int ep);
|
|
Hans de Goede |
c8dfc6 |
void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled);
|
|
Hans de Goede |
c8dfc6 |
+USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep,
|
|
Hans de Goede |
c8dfc6 |
+ uint64_t id);
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
void usb_attach(USBPort *port);
|
|
Hans de Goede |
c8dfc6 |
void usb_detach(USBPort *port);
|
|
Hans de Goede |
c8dfc6 |
diff --git a/hw/usb/core.c b/hw/usb/core.c
|
|
Hans de Goede |
c8dfc6 |
index be6d936..fe431d0 100644
|
|
Hans de Goede |
c8dfc6 |
--- a/hw/usb/core.c
|
|
Hans de Goede |
c8dfc6 |
+++ b/hw/usb/core.c
|
|
Hans de Goede |
c8dfc6 |
@@ -726,3 +726,18 @@ void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled)
|
|
Hans de Goede |
c8dfc6 |
struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
|
|
Hans de Goede |
c8dfc6 |
uep->pipeline = enabled;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
+
|
|
Hans de Goede |
c8dfc6 |
+USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep,
|
|
Hans de Goede |
c8dfc6 |
+ uint64_t id)
|
|
Hans de Goede |
c8dfc6 |
+{
|
|
Hans de Goede |
c8dfc6 |
+ struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
|
|
Hans de Goede |
c8dfc6 |
+ USBPacket *p;
|
|
Hans de Goede |
c8dfc6 |
+
|
|
Hans de Goede |
c8dfc6 |
+ while ((p = QTAILQ_FIRST(&uep->queue)) != NULL) {
|
|
Hans de Goede |
c8dfc6 |
+ if (p->id == id) {
|
|
Hans de Goede |
c8dfc6 |
+ return p;
|
|
Hans de Goede |
c8dfc6 |
+ }
|
|
Hans de Goede |
c8dfc6 |
+ }
|
|
Hans de Goede |
c8dfc6 |
+
|
|
Hans de Goede |
c8dfc6 |
+ return NULL;
|
|
Hans de Goede |
c8dfc6 |
+}
|
|
Hans de Goede |
c8dfc6 |
--
|
|
Hans de Goede |
c8dfc6 |
1.7.12
|
|
Hans de Goede |
c8dfc6 |
|