diff options
| author | Anthony Liguori <anthony@codemonkey.ws> | 2013-10-31 17:00:25 +0100 |
|---|---|---|
| committer | Anthony Liguori <anthony@codemonkey.ws> | 2013-10-31 17:00:25 +0100 |
| commit | cb95ec1b83ae3972a976e5331f9e772cde1ebd1c (patch) | |
| tree | c9c44da51edbc45763a0c88d65c8278f02f3e2de /hw/usb/host-libusb.c | |
| parent | 3fa4270a651503ac1a6aec5154ef17171ddae4e9 (diff) | |
| parent | c90daa1c109348099088c1cc954c1e9f3392ae03 (diff) | |
| download | focaccia-qemu-cb95ec1b83ae3972a976e5331f9e772cde1ebd1c.tar.gz focaccia-qemu-cb95ec1b83ae3972a976e5331f9e772cde1ebd1c.zip | |
Merge remote-tracking branch 'kraxel/usb.91' into staging
* kraxel/usb.91: usb-hcd-xhci: Update endpoint context dequeue pointer for streams too usb-hcd-xhci: Report completion of active transfer with CC_STOPPED on ep stop usb-hcd-xhci: Remove unused cancelled member from XHCITransfer usb-hcd-xhci: Remove unused sstreamsm member from XHCIStreamContext usb-host-libusb: Detach kernel drivers earlier usb-host-libusb: Configuration 0 may be a valid configuration usb-host-libusb: Fix reset handling Message-id: 1382620267-18065-1-git-send-email-kraxel@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
Diffstat (limited to 'hw/usb/host-libusb.c')
| -rw-r--r-- | hw/usb/host-libusb.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index 128955dd92..fd320cd8aa 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -137,6 +137,7 @@ static QTAILQ_HEAD(, USBHostDevice) hostdevs = static void usb_host_auto_check(void *unused); static void usb_host_release_interfaces(USBHostDevice *s); static void usb_host_nodev(USBHostDevice *s); +static void usb_host_detach_kernel(USBHostDevice *s); static void usb_host_attach_kernel(USBHostDevice *s); /* ------------------------------------------------------------------------ */ @@ -787,10 +788,13 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev) goto fail; } - libusb_get_device_descriptor(dev, &s->ddesc); s->dev = dev; s->bus_num = bus_num; s->addr = addr; + + usb_host_detach_kernel(s); + + libusb_get_device_descriptor(dev, &s->ddesc); usb_host_get_port(s->dev, s->port, sizeof(s->port)); usb_ep_init(udev); @@ -992,15 +996,14 @@ static int usb_host_claim_interfaces(USBHostDevice *s, int configuration) udev->ninterfaces = 0; udev->configuration = 0; - if (configuration == 0) { - /* address state - ignore */ - return USB_RET_SUCCESS; - } - usb_host_detach_kernel(s); rc = libusb_get_active_config_descriptor(s->dev, &conf); if (rc != 0) { + if (rc == LIBUSB_ERROR_NOT_FOUND) { + /* address state - ignore */ + return USB_RET_SUCCESS; + } return USB_RET_STALL; } @@ -1052,7 +1055,6 @@ static void usb_host_set_config(USBHostDevice *s, int config, USBPacket *p) trace_usb_host_set_config(s->bus_num, s->addr, config); usb_host_release_interfaces(s); - usb_host_detach_kernel(s); rc = libusb_set_configuration(s->dh, config); if (rc != 0) { usb_host_libusb_error("libusb_set_configuration", rc); @@ -1256,16 +1258,14 @@ static void usb_host_flush_ep_queue(USBDevice *dev, USBEndpoint *ep) static void usb_host_handle_reset(USBDevice *udev) { USBHostDevice *s = USB_HOST_DEVICE(udev); + int rc; trace_usb_host_reset(s->bus_num, s->addr); - if (udev->configuration == 0) { - return; + rc = libusb_reset_device(s->dh); + if (rc != 0) { + usb_host_nodev(s); } - usb_host_release_interfaces(s); - libusb_reset_device(s->dh); - usb_host_claim_interfaces(s, 0); - usb_host_ep_update(s); } /* |