diff options
author | Hans de Goede <hdegoede@redhat.com> | 2012-12-14 14:35:46 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2013-01-07 12:57:24 +0100 |
commit | e97f0aca796fb949f9d34c50603511048a52b39b (patch) | |
tree | 20079189745650d90ff83df8cd384632322b7489 /hw/usb | |
parent | bd019b735ac422bf9a40e1865e3d59f2e128604f (diff) | |
download | qemu-e97f0aca796fb949f9d34c50603511048a52b39b.zip qemu-e97f0aca796fb949f9d34c50603511048a52b39b.tar.gz qemu-e97f0aca796fb949f9d34c50603511048a52b39b.tar.bz2 |
usb-redir: Add debugging to bufpq save / restore
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.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index ad22491..f15dc91 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -61,6 +61,7 @@ struct buf_packet { }; struct endp_data { + USBRedirDevice *dev; uint8_t type; uint8_t interval; uint8_t interface; /* bInterfaceNumber this ep belongs to */ @@ -1070,6 +1071,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); } } @@ -1783,22 +1785,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; @@ -1810,6 +1816,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; } |