mirror of https://github.com/xemu-project/xemu.git
usb hub: don't return an overrun when there's no new status
This commit is contained in:
parent
eac9d5d608
commit
d532051a8e
|
@ -457,13 +457,6 @@ static void usb_hub_handle_data(USBDevice *dev, USBPacket *p)
|
|||
unsigned int status;
|
||||
uint8_t buf[4];
|
||||
int i, n;
|
||||
n = (NUM_PORTS + 1 + 7) / 8;
|
||||
if (p->iov.size == 1) { /* FreeBSD workaround */
|
||||
n = 1;
|
||||
} else if (n > p->iov.size) {
|
||||
p->status = USB_RET_BABBLE;
|
||||
return;
|
||||
}
|
||||
status = 0;
|
||||
for(i = 0; i < NUM_PORTS; i++) {
|
||||
port = &s->ports[i];
|
||||
|
@ -471,6 +464,13 @@ static void usb_hub_handle_data(USBDevice *dev, USBPacket *p)
|
|||
status |= (1 << (i + 1));
|
||||
}
|
||||
if (status != 0) {
|
||||
n = (NUM_PORTS + 1 + 7) / 8;
|
||||
if (p->iov.size == 1) { /* FreeBSD workaround */
|
||||
n = 1;
|
||||
} else if (n > p->iov.size) {
|
||||
p->status = USB_RET_BABBLE;
|
||||
return;
|
||||
}
|
||||
trace_usb_hub_status_report(s->dev.addr, status);
|
||||
for(i = 0; i < n; i++) {
|
||||
buf[i] = status >> (8 * i);
|
||||
|
|
Loading…
Reference in New Issue