aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-hub.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-08-04 17:10:36 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-04 17:10:36 -0500
commit5df0a2a5ba54114afb2bf75cab9fb184020a46a8 (patch)
tree40565e20dad22056e9d33b09c46d7f009b9acde3 /hw/usb-hub.c
parent47bf05d7eb550905c635724ce72f855fb4e10b3d (diff)
parentfb8f4ceeb837a7410e018619daae6bc821060503 (diff)
Merge remote-tracking branch 'kraxel/usb.22' into staging
Diffstat (limited to 'hw/usb-hub.c')
-rw-r--r--hw/usb-hub.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index b49a2fe882..c49c547d0c 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -394,11 +394,12 @@ static int usb_hub_handle_data(USBDevice *dev, USBPacket *p)
if (p->devep == 1) {
USBHubPort *port;
unsigned int status;
+ uint8_t buf[4];
int i, n;
n = (NUM_PORTS + 1 + 7) / 8;
- if (p->len == 1) { /* FreeBSD workaround */
+ if (p->iov.size == 1) { /* FreeBSD workaround */
n = 1;
- } else if (n > p->len) {
+ } else if (n > p->iov.size) {
return USB_RET_BABBLE;
}
status = 0;
@@ -409,8 +410,9 @@ static int usb_hub_handle_data(USBDevice *dev, USBPacket *p)
}
if (status != 0) {
for(i = 0; i < n; i++) {
- p->data[i] = status >> (8 * i);
+ buf[i] = status >> (8 * i);
}
+ usb_packet_copy(p, buf, n);
ret = n;
} else {
ret = USB_RET_NAK; /* usb11 11.13.1 */