aboutsummaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-04-19 13:36:40 +0200
committerGerd Hoffmann <kraxel@redhat.com>2012-04-26 12:21:16 +0200
commit0b377169b18d702d980d526578d8515900ca6eb1 (patch)
tree204f391f855872e11a8bea1e216a0987bf9cba1b /hw/usb
parent818d59dc179b2861e49f3c6472787a23935aac0d (diff)
downloadqemu-0b377169b18d702d980d526578d8515900ca6eb1.zip
qemu-0b377169b18d702d980d526578d8515900ca6eb1.tar.gz
qemu-0b377169b18d702d980d526578d8515900ca6eb1.tar.bz2
usb-host: fix zero-length packets
usb-host optimizes away zero-length packets by not entering the processing loop at all. Which isn't correct, we should submit a zero-length urb to the host devicein that case. This patch makes sure we run the processing loop at least once. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r--hw/usb/host-linux.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c
index c3684c8..048f8ff 100644
--- a/hw/usb/host-linux.c
+++ b/hw/usb/host-linux.c
@@ -887,8 +887,8 @@ static int usb_host_handle_data(USBDevice *dev, USBPacket *p)
prem = 0;
pbuf = NULL;
rem = p->iov.size;
- while (rem) {
- if (prem == 0) {
+ do {
+ if (prem == 0 && rem > 0) {
assert(v < p->iov.niov);
prem = p->iov.iov[v].iov_len;
pbuf = p->iov.iov[v].iov_base;
@@ -938,7 +938,7 @@ static int usb_host_handle_data(USBDevice *dev, USBPacket *p)
return USB_RET_STALL;
}
}
- }
+ } while (rem > 0);
return USB_RET_ASYNC;
}