|
Hans de Goede |
0fa3e5 |
From c6b10d4d87d8158c1b0bd8648491db8501dff784 Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
0fa3e5 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
0fa3e5 |
Date: Sat, 31 Mar 2012 13:07:24 +0200
|
|
Hans de Goede |
0fa3e5 |
Subject: [PATCH 144/146] usb-redir: An interface count of 0 is a valid value
|
|
Hans de Goede |
0fa3e5 |
|
|
Hans de Goede |
0fa3e5 |
An interface-count of 0 happens when a device is in unconfigured state when
|
|
Hans de Goede |
0fa3e5 |
it gets redirected. So we should not use 0 to detect not having received
|
|
Hans de Goede |
0fa3e5 |
interface info from our peer.
|
|
Hans de Goede |
0fa3e5 |
|
|
Hans de Goede |
0fa3e5 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
0fa3e5 |
---
|
|
Hans de Goede |
0fa3e5 |
usb-redir.c | 5 +++--
|
|
Hans de Goede |
0fa3e5 |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
Hans de Goede |
0fa3e5 |
|
|
Hans de Goede |
0fa3e5 |
diff --git a/usb-redir.c b/usb-redir.c
|
|
Hans de Goede |
0fa3e5 |
index 8ee3f07..3187b68 100644
|
|
Hans de Goede |
0fa3e5 |
--- a/usb-redir.c
|
|
Hans de Goede |
0fa3e5 |
+++ b/usb-redir.c
|
|
Hans de Goede |
0fa3e5 |
@@ -39,6 +39,7 @@
|
|
Hans de Goede |
0fa3e5 |
#include "hw/usb.h"
|
|
Hans de Goede |
0fa3e5 |
|
|
Hans de Goede |
0fa3e5 |
#define MAX_ENDPOINTS 32
|
|
Hans de Goede |
0fa3e5 |
+#define NO_INTERFACE_INFO 255 /* Valid interface_count always <= 32 */
|
|
Hans de Goede |
0fa3e5 |
#define EP2I(ep_address) (((ep_address & 0x80) >> 3) | (ep_address & 0x0f))
|
|
Hans de Goede |
0fa3e5 |
#define I2EP(i) (((i & 0x10) << 3) | (i & 0x0f))
|
|
Hans de Goede |
0fa3e5 |
|
|
Hans de Goede |
0fa3e5 |
@@ -995,7 +996,7 @@ static void usbredir_handle_destroy(USBDevice *udev)
|
|
Hans de Goede |
0fa3e5 |
|
|
Hans de Goede |
0fa3e5 |
static int usbredir_check_filter(USBRedirDevice *dev)
|
|
Hans de Goede |
0fa3e5 |
{
|
|
Hans de Goede |
0fa3e5 |
- if (dev->interface_info.interface_count == 0) {
|
|
Hans de Goede |
0fa3e5 |
+ if (dev->interface_info.interface_count == NO_INTERFACE_INFO) {
|
|
Hans de Goede |
0fa3e5 |
ERROR("No interface info for device\n");
|
|
Hans de Goede |
0fa3e5 |
goto error;
|
|
Hans de Goede |
0fa3e5 |
}
|
|
Hans de Goede |
0fa3e5 |
@@ -1158,7 +1159,7 @@ static void usbredir_device_disconnect(void *priv)
|
|
Hans de Goede |
0fa3e5 |
for (i = 0; i < MAX_ENDPOINTS; i++) {
|
|
Hans de Goede |
0fa3e5 |
QTAILQ_INIT(&dev->endpoint[i].bufpq);
|
|
Hans de Goede |
0fa3e5 |
}
|
|
Hans de Goede |
0fa3e5 |
- dev->interface_info.interface_count = 0;
|
|
Hans de Goede |
0fa3e5 |
+ dev->interface_info.interface_count = NO_INTERFACE_INFO;
|
|
Hans de Goede |
0fa3e5 |
}
|
|
Hans de Goede |
0fa3e5 |
|
|
Hans de Goede |
0fa3e5 |
static void usbredir_interface_info(void *priv,
|
|
Hans de Goede |
0fa3e5 |
--
|
|
Hans de Goede |
0fa3e5 |
1.7.9.3
|
|
Hans de Goede |
0fa3e5 |
|