From 102cf2fea3a05da5294ed6d8f49bc209f7328724 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 4 Mar 2012 11:57:44 +0100
Subject: [PATCH 22/35] usb-redir: Return USB_RET_NAK when we've no data for
 an interrupt endpoint

RH-Author: Hans de Goede <hdegoede@redhat.com>
Message-id: <1330862278-22314-8-git-send-email-hdegoede@redhat.com>
Patchwork-id: 37922
O-Subject: [PATCH 07/21] usb-redir: Return USB_RET_NAK when we've no data for an interrupt endpoint
Bugzilla: 758104
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
RH-Acked-by: Alon Levy <alevy@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@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>
(cherry picked from commit e64722108c1342d499d408c386ce65794c44dd63)
---
 usb-redir.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 usb-redir.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/usb-redir.c b/usb-redir.c
index f20fb86..007df2a 100644
--- a/usb-redir.c
+++ b/usb-redir.c
@@ -553,7 +553,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);
-- 
1.7.7.6

