qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/3] usb-redir: An interface count of 0 is a valid value
@ 2012-03-31 15:14 Hans de Goede
  2012-03-31 15:14 ` [Qemu-devel] [PATCH 2/3] usb-redir: Reset device address and speed on disconnect Hans de Goede
  2012-03-31 15:14 ` [Qemu-devel] [PATCH 3/3] usb-redir: Not finding an async urb id is not an error Hans de Goede
  0 siblings, 2 replies; 3+ messages in thread
From: Hans de Goede @ 2012-03-31 15:14 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Hans de Goede, qemu-devel

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>
---
 hw/usb/redirect.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index c9d22e4..9cea7c1 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))
 
@@ -968,7 +969,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;
     }
@@ -1132,7 +1133,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,
-- 
1.7.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-31 15:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-31 15:14 [Qemu-devel] [PATCH 1/3] usb-redir: An interface count of 0 is a valid value Hans de Goede
2012-03-31 15:14 ` [Qemu-devel] [PATCH 2/3] usb-redir: Reset device address and speed on disconnect Hans de Goede
2012-03-31 15:14 ` [Qemu-devel] [PATCH 3/3] usb-redir: Not finding an async urb id is not an error Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).