qemu/0127-usb-core-Don-t-set-packet-state-to-complete-on-a-nak.patch
2012-10-28 14:05:07 -04:00

38 lines
1.2 KiB
Diff

From bcd7c845fbfbafe03e320fbffcaa32417cfd5267 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 3 Sep 2012 12:33:44 +0200
Subject: [PATCH] usb-core: Don't set packet state to complete on a nak
This way the hcd can re-use the same packet to retry without needing
to re-init it.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit cc40997489260f405aecccd30d4626ceee862502)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
hw/usb/core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/usb/core.c b/hw/usb/core.c
index 2da38e7..be6d936 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -399,8 +399,10 @@ int usb_handle_packet(USBDevice *dev, USBPacket *p)
* otherwise packets can complete out of order!
*/
assert(!p->ep->pipeline);
- p->result = ret;
- usb_packet_set_state(p, USB_PACKET_COMPLETE);
+ if (ret != USB_RET_NAK) {
+ p->result = ret;
+ usb_packet_set_state(p, USB_PACKET_COMPLETE);
+ }
}
} else {
ret = USB_RET_ASYNC;
--
1.7.12.1