Patchwork [20/21] usb-redir: Return USB_RET_NAK when we've no data for an interrupt endpoint

login
register
mail settings
Submitter Gerd Hoffmann
Date Feb. 28, 2012, 10:20 a.m.
Message ID <1330424430-23015-21-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/143389/
State New
Headers show

Comments

Gerd Hoffmann - Feb. 28, 2012, 10:20 a.m.
From: Hans de Goede <hdegoede@redhat.com>

We should return USB_RET_NAK, rather then a 0 sized packet, when we've no data
for an interrupt IN endpoint.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 usb-redir.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Patch

diff --git a/usb-redir.c b/usb-redir.c
index d905463..755492f 100644
--- a/usb-redir.c
+++ b/usb-redir.c
@@ -548,7 +548,10 @@  static int usbredir_handle_interrupt_data(USBRedirDevice *dev,
             /* Check interrupt_error for stream errors */
             status = dev->endpoint[EP2I(ep)].interrupt_error;
             dev->endpoint[EP2I(ep)].interrupt_error = 0;
-            return usbredir_handle_status(dev, status, 0);
+            if (status) {
+                return usbredir_handle_status(dev, status, 0);
+            }
+            return USB_RET_NAK;
         }
         DPRINTF("interrupt-token-in ep %02X status %d len %d\n", ep,
                 intp->status, intp->len);