[16/22] usb-redir: When a packet contains data on a stall, ignore the stall

Message ID 1350297511-25437-17-git-send-email-hdegoede@redhat.com
State New
Headers show

Commit Message

Hans de Goede Oct. 15, 2012, 10:38 a.m.
It is possbile for bulk packets to transfer some of the data and
to then stall. ATM our usb core allows us to return either data, or an
error, not both. For now return the data rather then the stall when this
happens, counting on further packets to detect the stall.
In the future we should fix the qemu usb core to handle packets
completing with some data and an error.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
 hw/usb/redirect.c | 4 ++++
 1 file changed, 4 insertions(+)


diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 84b9705..99e25d4 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1152,6 +1152,10 @@  static int usbredir_handle_status(USBRedirDevice *dev,
     case usb_redir_success:
         return actual_len;
     case usb_redir_stall:
+        if (actual_len > 0) {
+            WARNING("got both data and stall, returning data\n");
+            return actual_len;
+        }
         return USB_RET_STALL;
     case usb_redir_cancelled: