|
|
5544c1 |
From 3c2f94fdc5e776ee66bccc704884f3b1b090b4c6 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
|
|
|
5544c1 |
Subject: [PATCH] usb-core: Add a usb_ep_find_packet_by_id() helper 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>
|
|
|
5544c1 |
(cherry picked from commit c13a9e61366cc3e28299d8faeb65e65c6e5964cf)
|
|
|
5544c1 |
|
|
|
5544c1 |
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.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 |
--
|
|
|
5544c1 |
1.7.12.1
|
|
Hans de Goede |
c8dfc6 |
|