aboutsummaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-03-31 17:14:21 +0200
committerGerd Hoffmann <kraxel@redhat.com>2012-04-26 12:21:17 +0200
commit1510168e273a12a56e3bd4488b4b2904f5138e09 (patch)
tree085318f8e53ccea6a03575501e583696e34af3f1 /hw/usb
parent215bff17ed89733c23174494cbff63ab941368ca (diff)
usb-redir: An interface count of 0 is a valid value
An interface-count of 0 happens when a device is in unconfigured state when it gets redirected. So we should not use 0 to detect not having received interface info from our peer. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r--hw/usb/redirect.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 94ab4632ca..3e6e7e9c73 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -39,6 +39,7 @@
#include "hw/usb.h"
#define MAX_ENDPOINTS 32
+#define NO_INTERFACE_INFO 255 /* Valid interface_count always <= 32 */
#define EP2I(ep_address) (((ep_address & 0x80) >> 3) | (ep_address & 0x0f))
#define I2EP(i) (((i & 0x10) << 3) | (i & 0x0f))
@@ -970,7 +971,7 @@ static void usbredir_handle_destroy(USBDevice *udev)
static int usbredir_check_filter(USBRedirDevice *dev)
{
- if (dev->interface_info.interface_count == 0) {
+ if (dev->interface_info.interface_count == NO_INTERFACE_INFO) {
ERROR("No interface info for device\n");
goto error;
}
@@ -1134,7 +1135,7 @@ static void usbredir_device_disconnect(void *priv)
QTAILQ_INIT(&dev->endpoint[i].bufpq);
}
usb_ep_init(&dev->dev);
- dev->interface_info.interface_count = 0;
+ dev->interface_info.interface_count = NO_INTERFACE_INFO;
}
static void usbredir_interface_info(void *priv,