|
Hans de Goede |
1b1995 |
From 9726556968aef62213b80bd4e351a4f7f721f941 Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
1b1995 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
1b1995 |
Date: Thu, 1 Mar 2012 17:22:14 +0100
|
|
Hans de Goede |
1b1995 |
Subject: [PATCH 137/140] usb: return BABBLE rather then NAK when we receive
|
|
Hans de Goede |
1b1995 |
too much data
|
|
Hans de Goede |
1b1995 |
|
|
Hans de Goede |
1b1995 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
1b1995 |
---
|
|
Hans de Goede |
1b1995 |
usb-linux.c | 8 +++++++-
|
|
Hans de Goede |
1b1995 |
usb-redir.c | 4 ++--
|
|
Hans de Goede |
1b1995 |
2 files changed, 9 insertions(+), 3 deletions(-)
|
|
Hans de Goede |
1b1995 |
|
|
Hans de Goede |
1b1995 |
diff --git a/usb-linux.c b/usb-linux.c
|
|
Hans de Goede |
1b1995 |
index ab4c693..b2d70f9 100644
|
|
Hans de Goede |
1b1995 |
--- a/usb-linux.c
|
|
Hans de Goede |
1b1995 |
+++ b/usb-linux.c
|
|
Hans de Goede |
1b1995 |
@@ -390,6 +390,10 @@ static void async_complete(void *opaque)
|
|
Hans de Goede |
1b1995 |
p->result = USB_RET_STALL;
|
|
Hans de Goede |
1b1995 |
break;
|
|
Hans de Goede |
1b1995 |
|
|
Hans de Goede |
1b1995 |
+ case -EOVERFLOW:
|
|
Hans de Goede |
1b1995 |
+ p->result = USB_RET_BABBLE;
|
|
Hans de Goede |
1b1995 |
+ break;
|
|
Hans de Goede |
1b1995 |
+
|
|
Hans de Goede |
1b1995 |
default:
|
|
Hans de Goede |
1b1995 |
p->result = USB_RET_NAK;
|
|
Hans de Goede |
1b1995 |
break;
|
|
Hans de Goede |
1b1995 |
@@ -718,6 +722,8 @@ static int urb_status_to_usb_ret(int status)
|
|
Hans de Goede |
1b1995 |
switch (status) {
|
|
Hans de Goede |
1b1995 |
case -EPIPE:
|
|
Hans de Goede |
1b1995 |
return USB_RET_STALL;
|
|
Hans de Goede |
1b1995 |
+ case -EOVERFLOW:
|
|
Hans de Goede |
1b1995 |
+ return USB_RET_BABBLE;
|
|
Hans de Goede |
1b1995 |
default:
|
|
Hans de Goede |
1b1995 |
return USB_RET_NAK;
|
|
Hans de Goede |
1b1995 |
}
|
|
Hans de Goede |
1b1995 |
@@ -755,7 +761,7 @@ static int usb_host_handle_iso_data(USBHostDevice *s, USBPacket *p, int in)
|
|
Hans de Goede |
1b1995 |
} else if (aurb[i].urb.iso_frame_desc[j].actual_length
|
|
Hans de Goede |
1b1995 |
> p->iov.size) {
|
|
Hans de Goede |
1b1995 |
printf("husb: received iso data is larger then packet\n");
|
|
Hans de Goede |
1b1995 |
- len = USB_RET_NAK;
|
|
Hans de Goede |
1b1995 |
+ len = USB_RET_BABBLE;
|
|
Hans de Goede |
1b1995 |
/* All good copy data over */
|
|
Hans de Goede |
1b1995 |
} else {
|
|
Hans de Goede |
1b1995 |
len = aurb[i].urb.iso_frame_desc[j].actual_length;
|
|
Hans de Goede |
1b1995 |
diff --git a/usb-redir.c b/usb-redir.c
|
|
Hans de Goede |
1b1995 |
index 629c87d..61860ef 100644
|
|
Hans de Goede |
1b1995 |
--- a/usb-redir.c
|
|
Hans de Goede |
1b1995 |
+++ b/usb-redir.c
|
|
Hans de Goede |
1b1995 |
@@ -457,7 +457,7 @@ static int usbredir_handle_iso_data(USBRedirDevice *dev, USBPacket *p,
|
|
Hans de Goede |
1b1995 |
ERROR("received iso data is larger then packet ep %02X (%d > %d)\n",
|
|
Hans de Goede |
1b1995 |
ep, len, (int)p->iov.size);
|
|
Hans de Goede |
1b1995 |
bufp_free(dev, isop, ep);
|
|
Hans de Goede |
1b1995 |
- return USB_RET_NAK;
|
|
Hans de Goede |
1b1995 |
+ return USB_RET_BABBLE;
|
|
Hans de Goede |
1b1995 |
}
|
|
Hans de Goede |
1b1995 |
usb_packet_copy(p, isop->data, len);
|
|
Hans de Goede |
1b1995 |
bufp_free(dev, isop, ep);
|
|
Hans de Goede |
1b1995 |
@@ -576,7 +576,7 @@ static int usbredir_handle_interrupt_data(USBRedirDevice *dev,
|
|
Hans de Goede |
1b1995 |
if (len > p->iov.size) {
|
|
Hans de Goede |
1b1995 |
ERROR("received int data is larger then packet ep %02X\n", ep);
|
|
Hans de Goede |
1b1995 |
bufp_free(dev, intp, ep);
|
|
Hans de Goede |
1b1995 |
- return USB_RET_NAK;
|
|
Hans de Goede |
1b1995 |
+ return USB_RET_BABBLE;
|
|
Hans de Goede |
1b1995 |
}
|
|
Hans de Goede |
1b1995 |
usb_packet_copy(p, intp->data, len);
|
|
Hans de Goede |
1b1995 |
bufp_free(dev, intp, ep);
|
|
Hans de Goede |
1b1995 |
--
|
|
Hans de Goede |
1b1995 |
1.7.9.3
|
|
Hans de Goede |
1b1995 |
|