aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-05-08 13:54:45 +0200
committerGerd Hoffmann <kraxel@redhat.com>2012-05-14 10:22:20 +0200
commita2498f76b8ddd4011645e54faf6eb9281bd6f401 (patch)
treee215555bb9f2eabf0da561e740fc34b86e330c4b /hw
parent94d1991445fa3582c042ee4e5b72606e2fc39cc2 (diff)
downloadqemu-a2498f76b8ddd4011645e54faf6eb9281bd6f401.zip
qemu-a2498f76b8ddd4011645e54faf6eb9281bd6f401.tar.gz
qemu-a2498f76b8ddd4011645e54faf6eb9281bd6f401.tar.bz2
usb-host: handle guest-issued clear halt
Most important here is to update our internal endpoint state so we know the endpoint isn't in halted state any more. Without this usb-host tries to clear halt again with the next data transfer submitted. Doing this twice is (a) not correct and (b) confuses some usb devices, rendering them non-functional in the guest. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/usb/host-linux.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c
index 048f8ff..a95b0ed 100644
--- a/hw/usb/host-linux.c
+++ b/hw/usb/host-linux.c
@@ -1058,6 +1058,15 @@ static int usb_host_handle_control(USBDevice *dev, USBPacket *p,
ret = usb_host_set_interface(s, index, value);
trace_usb_host_req_emulated(s->bus_num, s->addr, p, ret);
return ret;
+
+ case EndpointOutRequest | USB_REQ_CLEAR_FEATURE:
+ if (value == 0) { /* clear halt */
+ int pid = (index & USB_DIR_IN) ? USB_TOKEN_IN : USB_TOKEN_OUT;
+ ioctl(s->fd, USBDEVFS_CLEAR_HALT, &index);
+ clear_halt(s, pid, index & 0x0f);
+ trace_usb_host_req_emulated(s->bus_num, s->addr, p, 0);
+ return 0;
+ }
}
/* The rest are asynchronous */