qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 25/26] usb-redir: Add debugging to bufpq save / rest


From: Hans de Goede
Subject: [Qemu-devel] [PATCH 25/26] usb-redir: Add debugging to bufpq save / restore
Date: Fri, 14 Dec 2012 14:35:46 +0100

Signed-off-by: Hans de Goede <address@hidden>
---
 hw/usb/redirect.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index b3a96f7..bc36210 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -60,6 +60,7 @@ struct buf_packet {
 };
 
 struct endp_data {
+    USBRedirDevice *dev;
     uint8_t type;
     uint8_t interval;
     uint8_t interface; /* bInterfaceNumber this ep belongs to */
@@ -1093,6 +1094,7 @@ static void usbredir_init_endpoints(USBRedirDevice *dev)
     usb_ep_init(&dev->dev);
     memset(dev->endpoint, 0, sizeof(dev->endpoint));
     for (i = 0; i < MAX_ENDPOINTS; i++) {
+        dev->endpoint[i].dev = dev;
         QTAILQ_INIT(&dev->endpoint[i].bufpq);
     }
 }
@@ -1805,22 +1807,26 @@ static const VMStateInfo usbredir_parser_vmstate_info = 
{
 static void usbredir_put_bufpq(QEMUFile *f, void *priv, size_t unused)
 {
     struct endp_data *endp = priv;
+    USBRedirDevice *dev = endp->dev;
     struct buf_packet *bufp;
-    int remain = endp->bufpq_size;
+    int i = 0;
 
     qemu_put_be32(f, endp->bufpq_size);
     QTAILQ_FOREACH(bufp, &endp->bufpq, next) {
+        DPRINTF("put_bufpq %d/%d len %d status %d\n", i + 1, endp->bufpq_size,
+                bufp->len, bufp->status);
         qemu_put_be32(f, bufp->len);
         qemu_put_be32(f, bufp->status);
         qemu_put_buffer(f, bufp->data, bufp->len);
-        remain--;
+        i++;
     }
-    assert(remain == 0);
+    assert(i == endp->bufpq_size);
 }
 
 static int usbredir_get_bufpq(QEMUFile *f, void *priv, size_t unused)
 {
     struct endp_data *endp = priv;
+    USBRedirDevice *dev = endp->dev;
     struct buf_packet *bufp;
     int i;
 
@@ -1832,6 +1838,8 @@ static int usbredir_get_bufpq(QEMUFile *f, void *priv, 
size_t unused)
         bufp->data = qemu_oom_check(malloc(bufp->len)); /* regular malloc! */
         qemu_get_buffer(f, bufp->data, bufp->len);
         QTAILQ_INSERT_TAIL(&endp->bufpq, bufp, next);
+        DPRINTF("get_bufpq %d/%d len %d status %d\n", i + 1, endp->bufpq_size,
+                bufp->len, bufp->status);
     }
     return 0;
 }
-- 
1.8.0.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]